discord.py

Why does my Discord.py Bot spam (and add numbers) in the chat?

Why does my Discord.py Bot spam (and add numbers) in the chat? Question: I am writing a discord bot which job is simply adding, subtracting and suming up numbers. Everything works fine exept when you type "-1" (to subtract a number from the sum) it will spam "-1 was subtracted from your apples. You got …

Total answers: 1

Close Discord message on button click

Close Discord message on button click Question: I have a select menu with a submit button. When submit is clicked I want to close the current message, submit the data and then open a new select menu but I am having trouble figuring out how to have the message close. How can I have the …

Total answers: 1

How to edit images in embeds (discord.py)

How to edit images in embeds (discord.py) Question: I have a command that generates a random color palette and it works pretty well. Then I wanted to add a button to it, a button that’d generate a new palette. I added the button, wrote a callback, but the callback just won’t work, because the interaction.response.edit_messsage() …

Total answers: 1

how to add a permission check to tree slash commands discord.py + dropdown menu

How can I only allow administrators to run my Discord slash command? Question: Question 1. How can I make it so that only an administrator can use a specific slash command? This is an example of one of my current slash commands: @client.tree.command(name="8ball", description = "gives an 8-ball style answer to any question") @app_commands.describe(thing_to_say = …

Total answers: 1

want to see who deleted the message on_message_delete

want to see who deleted the message on_message_delete Question: when somenone delets a message, it returns the author name, not who deleted the message. what should i change ? @client.event async def on_message_delete(message): if "discord.gg" not in message.content and "https://discord.gg/" not in message.content and "discord.gg/" not in message.content: log_channel = client.get_channel(N/A) embed = discord.Embed( title="Message …

Total answers: 2

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

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