mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 14:07:03 +01:00
Valid session required to get all them users
This commit is contained in:
parent
4672243ebe
commit
ddcf719cf6
@ -503,6 +503,7 @@ def create_authenticated_user():
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
@api.route("/user/<guild_id>/<user_id>")
|
@api.route("/user/<guild_id>/<user_id>")
|
||||||
|
@abort_if_guild_disabled()
|
||||||
def user_info(guild_id, user_id):
|
def user_info(guild_id, user_id):
|
||||||
usr = {
|
usr = {
|
||||||
"id": None,
|
"id": None,
|
||||||
@ -534,6 +535,8 @@ def user_info(guild_id, user_id):
|
|||||||
return jsonify(usr)
|
return jsonify(usr)
|
||||||
|
|
||||||
@api.route("/user/<guild_id>")
|
@api.route("/user/<guild_id>")
|
||||||
|
@abort_if_guild_disabled()
|
||||||
|
@valid_session_required(api=True)
|
||||||
def list_users(guild_id):
|
def list_users(guild_id):
|
||||||
all_users = get_all_users(guild_id)
|
all_users = get_all_users(guild_id)
|
||||||
return jsonify(all_users)
|
return jsonify(all_users)
|
||||||
|
@ -28,11 +28,13 @@ def discord_users_only(api=False):
|
|||||||
return decorated_function
|
return decorated_function
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
def abort_if_guild_disabled():
|
def abort_if_guild_disabled(*args):
|
||||||
def decorator(f):
|
def decorator(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
guild_id = request.args.get("guild_id", None)
|
guild_id = request.args.get("guild_id", None)
|
||||||
|
if not guild_id and len(args) > 0:
|
||||||
|
guild_id = args[0]
|
||||||
if guild_id in list_disabled_guilds():
|
if guild_id in list_disabled_guilds():
|
||||||
return ('', 423)
|
return ('', 423)
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user