From a66dcb64e27dd2ee8b01b6fee6e8b022a206015b Mon Sep 17 00:00:00 2001 From: 0x5c <0x5c.dev@gmail.com> Date: Fri, 4 Oct 2019 08:53:05 -0400 Subject: [PATCH] Added the info command - Now you can't say that you don't know where is the source >:( --- info.py | 16 ++++++++++++---- main.py | 27 ++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/info.py b/info.py index db7fdf5..e811817 100644 --- a/info.py +++ b/info.py @@ -2,11 +2,19 @@ Static info about the bot. --- -`authors`: The authors of the bot. -`description`: A description of the bot. -`release_timestamp`: When the bot was last released. +`authors`: The authors of the bot. + +`description`: A description of the bot. + +`license`: The license the bot is released under. + +`contrubuting`: Info on how to contribute to the bot. + +`release_timestamp`: When the bot was last released. """ -authors = ("@ClassAbbyAmplifier#2229", "@eyyyyyy#0006") +authors = ("@ClassAbbyAmplifier#2229", "@0x5c") description = """A description goes here.""" +license = "A license goes here." +contributing = "Info on contributing goes here." release_timestamp = "not yet :P" diff --git a/main.py b/main.py index a2c22e0..778cd7c 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,8 @@ Qrm, a bot for Discord [copyright here] """ +from types import SimpleNamespace + import discord import discord.ext.commands as commands @@ -14,11 +16,30 @@ import info import options as opt import keys -# --- Variables --- -debug_mode = opt.debug -bot = commands.Bot(command_prefix=opt.prefix, description=info.description) +# --- Global settings --- +debug_mode = opt.debug # Separate assignement in-case we define an override (ternary operator goes here) + + +bot_colours = SimpleNamespace(good=0x2dc614, neutral=0x2044f7, bad=0xc91628) + + +# --- Bot setup --- + +bot = commands.Bot(command_prefix=opt.prefix, description=info.description, help_command=commands.MinimalHelpCommand()) + + +# --- Commands --- + +@bot.command(name="info", aliases=["about"]) +async def _info(ctx): + """Shows info about qrm.""" + embed = discord.Embed(title="About qrm", description=info.description, colour=bot_colours.neutral) + embed = embed.add_field(name="Authors", value=", ".join(info.authors)) + embed = embed.add_field(name="Contributing", value=info.contributing) + embed = embed.add_field(name="License", value=info.license) + await ctx.send(embed=embed) try: bot.run(keys.discord_token)