From 0394f510ff6cbb93371e83f2463165589c81c33c Mon Sep 17 00:00:00 2001 From: JustMaffie Date: Sat, 27 May 2017 23:06:40 +0200 Subject: [PATCH] Start command update --- discordbot/config.example.py | 2 ++ discordbot/titanembeds/bot.py | 7 ++++--- webapp/titanembeds/blueprints/api/api.py | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/discordbot/config.example.py b/discordbot/config.example.py index 7fda5e8..1a30bb9 100644 --- a/discordbot/config.example.py +++ b/discordbot/config.example.py @@ -2,4 +2,6 @@ config = { 'bot-token': "Discord bot token", 'database-uri': "driver://username:password@host:port/database", + + 'command-prefix': "<@{}>".format("BOT ID HERE"), } \ No newline at end of file diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index c6346b9..9bff0fb 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -10,9 +10,10 @@ logging.basicConfig(filename='titanbot.log',level=logging.INFO,format='%(asctime logging.getLogger('TitanBot') logging.getLogger('sqlalchemy') -class Titan(discord.Client): - def __init__(self): - super().__init__() + +class Titan(commands.Bot): + def __init__(self, *args, **kwargs): + super().__init__(command_prefix = config['command-prefix']) self.aiosession = aiohttp.ClientSession(loop=self.loop) self.http.user_agent += ' TitanEmbeds-Bot' self.database = DatabaseInterface(self) diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index 9269b67..dad6c44 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -374,10 +374,11 @@ def create_unauthenticated_user(): response.status_code = 403 return response -@api.route("/update_unauthenticated_user", methods=["POST"]) -@rate_limiter.limit("1 per 15 minute", key_func=guild_ratelimit_key) -def update_unauthenticated_user(): - # todo: update user +# @api.route("/update_unauthenticated_user", methods=["POST"]) +# @rate_limiter.limit("1 per 15 minute", key_func=guild_ratelimit_key) +# def update_unauthenticated_user(): +# # todo: update user +# new_name = request.form.get('new_username') @api.route("/query_guild", methods=["GET"]) @valid_session_required(api=True)