Category : discord.py

@client.command() async def blackjack(ctx): y= random.choice(deck) x=random.choice(deck) z=random.choice(deck) a=random.choice(deck) await ctx.send(f'{x, y}’) await ctx.send(f'{a, z}’) m = await client.wait_for("message", check=None) if m == "Stand": B = x+y S = a+z if S < B: while S < B or S < 21: await ctx.send(S= a+z+random.choice(deck)) if S > 21: ctx.send("You win") else: ctx.send("You Lose") else: ..

Read more

I want to create the channel in the category of the users liking but when i try to run the program it doesn’t make the channel in the category i want it to. Here’s my code: if sly.content.startswith("sly ctchan"): x=sly.content.split("sly ctchan ",1)[1] await sly.channel.send("Category Name") y=await client.wait_for(‘message’, timeout=15.0) z=discord.utils.get(sly.guild.categories, name =y) await sly.guild.create_text_channel(x, overwrites=None, category=z) ..

Read more

I am getting the following error message: Traceback (most recent call last): File "C:UsersmrshePycharmProjectsmodmailmain.py", line 28, in <module> bot.load_extension(f’cogs.{filename[:-3]}’) AttributeError: module ‘discord.ext.commands.bot’ has no attribute ‘load_extension’ and the code I’m using is for filename in os.listdir(‘./cogs’): if filename.endswith(‘.py’): bot.load_extension(f’cogs.{filename[:-3]}’) print(f’LOADED {filename}’) Source: Python..

Read more

@client.command() async def reactrole(ctx, emoji, role:discord.Role, *, message): embed = discord.Embed(description=message) msg = await ctx.channel.send(embed=embed) await msg.add_reaction(emoji) with open(‘reactrole.json’) as json_file: data = json.load(json_file) new_react_role = { ‘role_name’:role.name, ‘role.id’:role.id, ’emoji’:emoji, ‘message_id’:msg.id } data.append(new_react_role) with open(‘reactrole.json’, ‘w’) as j: json.dump(data, j, indent=4) @client.event async def on_raw_reaction_add(payload): if payload.member.bot: pass else: with open(‘reactrole.json’) as react_file: data = ..

Read more

Traceback (most recent call last): File "C:UserskolbaxxPycharmProjectspythonProjectdiscordmain.py", line 2, in <module> from discord.ext import commands ModuleNotFoundError: No module named ‘discord.ext’ I was Writing my bot for a couple of day with pycharm and averything worked normaly. But today suddendly I can’t run it anymore and still got this error Message for Import doesn’t working. I ..

Read more

I have coded the bot to mute users using a command like .m @user but if I tag a moderator then the bot is muting the mods too. How to fix this code? @bot.command(aliases=[‘m’]) @commands.has_permissions(kick_members=True) async def mute(ctx,member:discord.Member): muted_role = ctx.guild.get_role(900024798585954325) await member.add_roles(muted_role) embed=discord.Embed(title="User Muted!", description=f"{member.mention} has been muted") await ctx.send(embed=embed) Source: Python..

Read more