discord.py

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

how to add a permission check to tree slash commands discord.py + dropdown menu Question: Q1 – 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") …

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

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

How do I add a discord category to a server through a bot?

How do I add a discord category to a server through a bot? Question: In order to quickly set up a server, I’m trying to construct a discord bot in Python that accepts the command "!Create {Category name here}" and then generates a category packed with text channels from a list of strings stored in …

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