all classes moved into file
some commands moved into cogs
This commit is contained in:
31
cogs/info.py
Normal file
31
cogs/info.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import logging
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from dislash import slash_command
|
||||
|
||||
|
||||
class Bot_info(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot # defining bot as global var in class
|
||||
|
||||
@commands.Cog.listener() # this is a decorator for events/listeners
|
||||
async def on_ready(self):
|
||||
logging.info(f'Cog {__name__.split(".")[1]} is ready!.')
|
||||
|
||||
@slash_command(name="info_bot") # this is for making a command
|
||||
async def info_bot(self, ctx):
|
||||
# await ctx.send(f'Pong! {round(self.bot.latency * 1000)}')
|
||||
emb = discord.Embed(
|
||||
title=f"General information",
|
||||
description=f"General information on about bot",
|
||||
)
|
||||
emb.add_field(name="Bot ping", value=f'Bot ping: {round(self.bot.latency * 1000)}', inline=True)
|
||||
# emb.add_field(name="Roles list", value=f"{roles}", inline=True)
|
||||
emb.set_footer(text="Information requested by: {}".format(ctx.author.display_name))
|
||||
|
||||
await ctx.reply(embed=emb, ephemeral=True)
|
||||
|
||||
|
||||
def setup(bot): # an extension must have a setup function
|
||||
bot.add_cog(Bot_info(bot)) # adding a cog
|
||||
Reference in New Issue
Block a user