Reputation: 112
This is probably a duplicate question or a newbie Python error, but I just can’t find the right terms to search for my answer.
My bot launches fine, and it even runs the print function on on_ready
! However, when I try using the commands there aren't any responses. It worked fine before I added the class GlobalBanningSystem(commands.Cog):
, so I dont know!
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = ".")
class GlobalBanningSystem(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.has_role("966695793555804232") # Staff Role ID
async def gban(self, ctx, member: discord.User):
channel = self.bot.get_channel("966681817094697020") # Logs Channel ID
auth = ctx.author
await ctx.send("Ban Issue successfuly opened. Now, please type the ban reason!")
reason = await self.bot.wait_for('message', timeout = 600)
embed = discord.Embed(title = f"Global Banned {member.name}", colour = 0xFF0000)
embed.add_field(name = "Reason:", value = reason.content, inline = False)
embed.add_field(name = "User ID:", value = f"`{member.id}`",)
embed.add_field(name = "Staff Member:", value = f"{auth.name}")
embed.set_thumbnail(url = member.avatar_url)
await ctx.send(embed = embed)
await ctx.send(f"**{member.name}** has been globbaly banned!")
for guild in self.bot.guilds:
await guild.ban(member)
@client.event
async def on_ready():
print("Global Banning System is online!")
@client.command()
async def ping(ctx):
await ctx.send(f"Bot's Response Latency: {round(client.latency * 1000)}ms")
client.run("token:>")
I was trying a ban command that would ban the user from:
Upvotes: 0
Views: 59
Reputation: 5387
You need to register the cog with your bot:
client.add_cog(GlobalBanningSystem(client))
Upvotes: 2