diff options
Diffstat (limited to 'bot.py')
-rw-r--r-- | bot.py | 48 |
1 files changed, 28 insertions, 20 deletions
@@ -1,20 +1,28 @@ -import discord -from discord.ext import commands - -BOT_NAME = "Cupido" - -client = discord.Client() -bot = commands.Bot(command_prefix='!<3') - - -@client.event -async def on_ready(): - print('{0} is logged in as {1.user}'.format(BOT_NAME, client)) - - -@bot.command() -async def init(ctx): - pass - - -client.run('token') +import config +from command_utils import Command, CommandClient + + +class Client(CommandClient): + async def on_ready(self): + print(f'the bot {config.NAME} is logged in as "{self.user}"') + + @Command.help_command + @Command.names('help', 'hepl', 'h', '?') + @Command.description('display this help message') + async def help(self, ctx): + await ctx.answer(config.HELP_TEXT) + + @Command.names('init', 'create', 'inti', 'craete', 'cretae', 'c', 'i', '+') + @Command.description('create a new lobby') + async def init(self, ctx): + await ctx.answer(f'NIY') + + +if __name__ == '__main__': + from os import getenv + token = getenv(config.TOKEN_ENV_VAR) + if token is None: + print('error: no token was given') + exit(1) + bot = Client() + bot.run(token) |