Category : discord.py

I asked a question about reaction roles earlier, that problem got solved but now I have another problem. Here’s my code: @client.event async def on_raw_reaction_add(payload): message_id = payload.message_id if message_id == 800172672860291132: guild_id = payload.guild_id guild = discord.utils.find(lambda g : g.id == guild_id, client.guilds) role = None if payload.emoji.name == ‘🔴’: role = discord.utils.get(guild.roles, name=’Red’) ..

Read more

My ping command doesn’t work in a cog but works in my main.py file. Here’s the code for the cog: import discord from discord.ext import commands class Misc(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): print(‘Misc cog loadedn—–‘) @commands.command() async def ping(self, ctx): await ctx.send(f’pong!n{round(bot.latency * 1000)}ms’) def setup(bot): bot.add_cog(Misc(bot)) When I ..

Read more

Every time I run my discord bot in Visual Studio Code, I get this error. Does anyone know how to fix this? I run macOS Cataline(10.15.7) and Python 3.9.1. [email protected] Iyioid % /usr/local/bin/python3 /Users/dillonbarnes/Downloads/Iyioid/main.py Traceback (most recent call last): File "/Users/dillonbarnes/Library/Python/3.9/lib/python/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File ..

Read more

I am stumped on why my join message isn’t working! I have the discord.py library installed, and I am really confused! I have other code below it, but it shouldn’t effect the above. import discord client = discord.Client() @client.event async def on_ready(): print(‘We have logged in as {0.user}’.format(client)) @client.event async def on_member_join(member): channel = client.get_channel(800395922764070942) ..

Read more