discord

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 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

How to call a function in a cog from a view using Nextcord?

How to call a function in a cog from a view using Nextcord? Question: I have a Cog and a view in nextcord. I’m trying to call the function magic_function from my view, but I’ve found no way of achieving it. Do you know how is it possible ? Here is a simplification of the …

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

Error: Unable to extract uploader id – Youtube, Discord.py

Error: Unable to extract uploader id – Youtube, Discord.py Question: I have a veary powerfull bot in discord (discord.py, PYTHON) and it can play music in voice channels. It gets the music from youtube (youtube_dl). It worked perfectly before but now it dosn’t wanna work with any video. I tried updataing youtube_dl but it still …

Total answers: 9

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