discord

How can i get all the pokémon types automatically with pokeapi?

How can i get all the pokémon types automatically with pokeapi? Question: I’m a beginner programmer, I’m adventuring with APIs and python. I would like to know if I can get all types of pok√©mon withou passing a number as I did here: import requests name = "charizard" url = f’https://pokeapi.co/api/v2/pokemon/%7Bname%7D’ poke_request = requests.get(url) poke_request …

Total answers: 2

I am trying to make a discord bot in which I want that as soon as user type into command channel his/her discord id must be printed

I am trying to make a discord bot in which I want that as soon as user type into command channel his/her discord id must be printed Question: if message.content.startswith(‘$register’): await message.channel.send(‘You are registered successfully’) userk = print(client.user.id) I am using Discord.py and Iam trying to get the Discord user id of a user when …

Total answers: 2

Discord bot not running code or responding

Discord bot not running code or responding Question: this code is meant to run whatever code is inputted with a command into a computer i have no errors and the test message works but it doesn’t run the code in the computer when input with the command and it doesn’t respond with the message "Code …

Total answers: 1

How can i make my discord.py bot kick command optional reason section to a required reason?

How can i make my discord.py bot kick command optional reason section to a required reason? Question: @bot.tree.command(name="kick", description="Kicks specified user from the server.") async def kick(interaction: discord.Interaction, member: discord.Member, reason: Optional[str] = None): if interaction.user.guild_permissions.kick_members: await member.kick(reason=reason) embed = discord.Embed(title="Successfully Kicked.",description=f"{member.mention} has been successfully kicked off the server.nFor {reason} reason.", color = discord.Color.green(), timestamp …

Total answers: 2

Cannot assign to global variable in on_ready()

Cannot assign to global variable in on_ready() Question: I am trying to code a discord bot that simultaneously prints new messages and sends user input from console to a selected channel. Here is what I have so far: import discord from threading import Thread from asyncio import run intents = discord.Intents.all() intents.members = True client …

Total answers: 1

How Can I Make a discord.py Bot Leave While Using a Command Tree

How Can I Make a discord.py Bot Leave While Using a Command Tree Question: I have spent over an hour on this. I am using command trees so that my commands will show up as slash commands. I already have a command to join a voice chat, however I cannot figure out how to leave. …

Total answers: 1

Using Discord's API to Register New Messages

Using Discord's API to Register New Messages Question: What I’m trying to understand is how Discord.py creates and sends responses from their on_message function. Take this as an example: @client.event() async def on_message(message): print(message.content) I’m trying to understand how Discord.py retrieves new messages from Discord without refreshing the channel histories for every single channel in …

Total answers: 1

Bug related to an add role command on discord.py

Bug related to an add role command on discord.py Question: I have this command I made with a Discord bot in Python. Basically, it’s an event where it gives you a "Saloon Member" role when you write "givemembership" this command has been working on some of my test servers but sometimes simply didn’t.(I always gave …

Total answers: 1

AttributeError: type object 'int' has no attribute 'repsonse'

AttributeError: type object 'int' has no attribute 'repsonse' Question: Trying slash commands in discord and i got this error Traceback (most recent call last): File "C:UsersHPAppDataLocalProgramsPythonPython311Libsite-packagesdiscordapp_commandscommands.py", line 862, in _do_call return await self._callback(interaction, **params) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "e:botbot.py", line 104, in hello await int.response.send_message ("Hey {interaction.user.mention} you suck! Cry about it!") ^^^^^^^^^^^^ AttributeError: …

Total answers: 1

How do you get a message from a channel?

How do you get a message from a channel? Question: channel = bot.get_channel(id_of_the_channel) message = await channel.fetch_message(id_of_the_message) I tried to use this code so that a bot could edit its own message, but there’s an error on the line with "fetch_message". File "main.py", line 280, in on_message message = await channel.fetch_message(messageid) AttributeError: ‘NoneType’ object has …

Total answers: 1