qrm2/cogs/basecog.py

48 lines
1.6 KiB
Python
Raw Normal View History

"""
2019-10-04 19:45:59 -04:00
Base cog for qrm
---
2019-10-05 02:23:11 -04:00
Copyright (C) 2019 Abigail Gold, 0x5c
2019-10-04 18:05:57 -04:00
2019-10-05 02:23:11 -04:00
This file is part of discord-qrmbot and is released under the terms of the GNU
General Public License, version 2.
"""
import discord
import discord.ext.commands as commands
from datetime import datetime
2019-10-04 18:16:47 -04:00
class BaseCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.gs = bot.get_cog("GlobalSettings")
@commands.command(name="info", aliases=["about"])
async def _info(self, ctx):
"""Shows info about qrm."""
embed = discord.Embed(title="About qrm",
description=self.gs.info.description,
colour=self.gs.colours.neutral,
timestamp=datetime.utcnow())
embed.set_footer(text=ctx.author.name,
icon_url=str(ctx.author.avatar_url))
embed = embed.add_field(name="Authors", value=", ".join(self.gs.info.authors))
embed = embed.add_field(name="Contributing", value=self.gs.info.contributing)
embed = embed.add_field(name="License", value=self.gs.info.license)
await ctx.send(embed=embed)
2019-10-04 19:48:58 -04:00
@commands.command(name="ping")
2019-10-04 19:45:59 -04:00
async def _ping(self, ctx):
embed = discord.Embed(title="**Pong!**",
description=f'Current ping is {self.bot.latency*1000:.1f} ms',
colour=self.gs.colours.neutral,
timestamp=datetime.utcnow())
embed.set_footer(text=ctx.author.name,
icon_url=str(ctx.author.avatar_url))
await ctx.send(embed=embed)
2019-10-04 19:45:59 -04:00
def setup(bot):
2019-10-04 18:16:47 -04:00
bot.add_cog(BaseCog(bot))