discord.py

GuildPrefix Command Confused

GuildPrefix Command Confused Question: @bot.command() async def guildprefix(ctx, prefix): with open(‘prefixes.json’, ‘r’) as f: prefixes = json.load(f) prefixes[str(ctx.guild.id)] = prefix with open(‘prefixes.json’, ‘w’) as f: json.dump(prefixes, f, indent=4) await ctx.send(f’Prefix changed to: {prefix}’) name=f'{prefix}BotBot’ def get_prefix(bot, message): with open(‘prefixes.json’, ‘r’) as f: prefixes = json.load(f) prefixes[str(message.guild.id)] = ‘.’ return prefixes[str(message.guild.id)] It logs the prefix but …

Total answers: 1

How can I implement multiple units simultaneously into a reminder command in d.py?

How can I implement multiple units simultaneously into a reminder command in d.py? Question: Short story long, here’s what I’m trying to do; I am in the process of making a reminder command for my discord bot, and I need it to take in multiple arguments, each containing a keyword (in this case a letter) …

Total answers: 1

How can I make a error message when there's no mention on discord.py?

How can I make a error message when there's no mention on discord.py? Question: I’m trying to do a error message when a member puts a text instead of a mention, but I canĀ“t. @bot.event async def on_command_error(ctx, error): if isinstance(error, ext.commands.errors.MissingRequiredArgument): await ctx.send(f"{ctx.author.mention}, you should specify a user!") @bot.command(name="kiss") async def kiss(ctx, member: discord.Member): …

Total answers: 2

Why I can't name a user without mention it on Discord.py?

Why I can't name a user without mention it on Discord.py? Question: I’m trying to name a user that are previously mentioned, but I can’t. This is the code: @bot.command(name="kiss") async def kiss(ctx, user): if ctx.message.channel.is_nsfw(): with open (‘kiss.json’) as kg: kissgifs = json.load(kg) ksrandomchoice = random.choice(kissgifs) embed = discord.Embed() embed.set_image(url=ksrandomchoice[‘kiss’]) embed.add_field(name=f"{ctx.author.name} kissed {user.mention}", value="") …

Total answers: 1

Discord.py missing permissions when bot role is above all and has admin privileges

Discord.py missing permissions when bot role is above all and has admin privileges Question: raise CommandInvokeError(self, e) from e discord.app_commands.errors.CommandInvokeError: Command ‘test’ raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions Constantly getting this error, even though my bot has administrator permissions, also the role is located at the top of the tree. …

Total answers: 1

AttributeError: 'Context' object has no attribute 'response' | discord.py

AttributeError: 'Context' object has no attribute 'response' | discord.py Question: `import discord from discord.ext import commands import time import json import platform from discord import ui class MyModal(ui.Modal): added = ui.TextInput(label=’What did you add’, placeholder=’## What did you add…’, style=discord.TextStyle.long) removed = ui.TextInput(label=’What did you remove’, placeholder=’## What did you remove…’, style=discord.TextStyle.long) class Client(commands.Bot): client …

Total answers: 1

Cogs TypeError: object NoneType can't be used in 'await' expression in discord.py

Cogs TypeError: object NoneType can't be used in 'await' expression in discord.py Question: I’ve been working on a discord bot for a personal server. I want to use cogs to separate the music player functionality from the main file. I am raising this error when I load my main.py file: discord.ext.commands.errors.ExtensionFailed: Extension ‘cogs.cog’ raised an …

Total answers: 1

Getting all guilds the bot is in and banning the member in all discords

Getting all guilds the bot is in and banning the member in all discords Question: So I am trying to get all guilds that the bot is in. Which I have done by: for guild in self.bot.guilds: guild = guild Using this I need to try and ban the member specified in all of the …

Total answers: 1

My Discord bot is not responding to messages/not even outputting to terminal?

My Discord bot is not responding to messages/not even outputting to terminal? Question: Trying to make a sorta complicated bot, but before i get started on writing the other code I wanted to just make sure that the bot worked in Discord, and was up and running and responding to a basic command – Send …

Total answers: 1

Clicking on button in discord channel does not execute the code in on_button_click

Clicking on button in discord channel does not execute the code in on_button_click Question: The purpose of this code is to create the channel if it doesnt exist (this works) and write a welcome message in it (this works) when you type in !open_ticket it should create a button and display it along with a …

Total answers: 1