discord.py

Get a Gif File from URL and Send It via a Discord Bot

Get a Gif File from URL and Send It via a Discord Bot Question: I cannot figure out how to get this to work (maybe I’m just bad at programming). As the name suggests, I want to send an gif image with my Discord bot when I say “!radar”. The gif is located at https://radar.weather.gov/ridge/standard/CONUS_0.gif …

Total answers: 2

Discord bot can not read content of the message

Discord bot can not read content of the message Question: HI I want to make a bot on discord. I can make a bot with see that message is coming. But it can not see a content of the message. my code: import discord import os client = discord.Client(intents=discord.Intents.default()) @client.event async def on_ready(): print("This is …

Total answers: 1

Trying To Make a Discord Bot – Error Role Not Found

Trying To Make a Discord Bot – Error Role Not Found Question: I have asked this question on the Replit forum but the developers are unsure of the problem. My friend and I want to add a function to our bot that gives a user the role Baguette_Team, and posts a message saying that they …

Total answers: 1

Discord.py — How would i make a variable server-specific?

Discord.py — How would i make a variable server-specific? Question: In discord.py, a variable is module-specific, not server specific. How would I make it so that a variable value only applies to a specific server? My code: @client.command() async def enable(ctx): await ctx.message.delete() global Toggle Toggle = True embed=discord.Embed(title="Enabled!", color=0x5e0000) embed.set_footer(text="To disable, do !disable.") user …

Total answers: 1

raise KeyboardInterrupt() KeyboardInterrupt | asyncio.exceptions.CancelledError

raise KeyboardInterrupt() KeyboardInterrupt | asyncio.exceptions.CancelledError Question: An error occurs when disabling the bot with Ctrl+C in VSCode Error: Traceback (most recent call last): File "C:Program FilesPython311Libasynciorunners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:Program FilesPython311Libasynciobase_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "E:BotsDiscordtbotmain.py", line 46, in main await bot.start(config[‘token’]) File "C:UsersArtemAppDataRoamingPythonPython311site-packagesdiscordclient.py", line 746, …

Total answers: 2

Discord Python Bot only responds to dms

Discord Python Bot only responds to dms Question: The bot has admin perms, I have no idea why it would do this, seems really weird… any ideas would be great…… This code was generated by ChatGPT btw Hsggsss hshsssggs Shsyshgsvsvevsgs Jshsgscsccsvshshshyw Hshshsggsfsgs import discord import random from discord.ext import commands # Define your phrases in …

Total answers: 1

Slash commands not appearing when loading them in cogs discord.py

Slash commands not appearing when loading them in cogs discord.py Question: When using cogs to organize slash commands, I can never get them to load. main.py import discord from discord.ext import commands from testing import MyCog bot = commands.Bot(command_prefix=’!’, intents=discord.Intents.all()) @bot.command() async def sync(ctx): await bot.add_cog(MyCog(bot)) await bot.tree.sync() await ctx.send(‘Synced’) bot.run("token") testing.py import discord from …

Total answers: 1

Discord.py 2.0.0 voice chat disconnection problem

Discord.py 2.0.0 voice chat disconnection problem Question: @commands.command(name="disconnect") async def _disconnect(self, ctx): voice_state = ctx.author.voice if voice_state is None: return for voice_client in ctx.bot.voice_clients: if voice_client.channel == ctx.author.voice.channel: await voice_client.disconnect() print("disconnected") The code executes fine but the bot is still in voice chat I tried changing ctx.bot.voice_clients: to self.bot.voice_clients: but it had no effect. I …

Total answers: 1

on raw reaction add throws an error: discord.py

on raw reaction add throws an error: discord.py Question: I was working on an "self-reaction" script for my discord bot, so I was using on_reaction_add() and it worked fine, but I realized that as I restarted my bot, he couldn’t register the reactions on that first message, so I did some research and I figured …

Total answers: 1