discord

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 bot stops | Discord.py

Discord bot stops | Discord.py Question: When the bot connects to the voice channel, the program stops and goes no further! I found this out by displaying the number 1 and 2 in the console: The console output number 1, then the bot connects to the voice channel and the number 2 is not displayed …

Total answers: 1

How to add images with Discord API and Python Requests

How to add images with Discord API and Python Requests Question: I want to send an image that I have stored on my computer through this code import requests import time headers = {‘authorization’: TOKEN, ‘Content-Type’: ‘application/json’} url = f"https://discord.com/api/v9/channels/{CHANNEL}/messages" data = { "content": message } files = { ‘file’: (open(‘image.png’, ‘rb’)), } r = …

Total answers: 1

Can I automate discord actions with python?

Can I automate discord actions with python? Question: I want to set up a python script that runs automatically in some situations which opens different programs and among other things joins my main discord voice channel. I figured out most of it, but with discord I am struggling so far. Every tutorial I found is …

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

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

TypeError: 'NoneType' object is not subscriptable, Discord Python Bot Mysql

TypeError: 'NoneType' object is not subscriptable, Discord Python Bot Mysql Question: Raw code: @ loop(hours=12) async def ticket_clear(): # try: cur.execute("SELECT auth_id, chann_id from tickets") for (auth_id, chann_id) in cur: channel = client.get_channel(chann_id) if (channel): return else: cur.execute( f"DELETE from tickets WHERE chann_id=%s", ((chann_id),)) conn.commit() # except: # print("Reconnecting") # await reconnect() Have some code …

Total answers: 1