[Solved] How to make bot respond to a certain msg?

You can do this one of two ways, either with the commands extension, or within the on_message event. Below is an example of how you can do this. With this example, when a user types “!ping” the bot will respond with “Pong”. If a message contains the word “foo”, then the bot will respond with … Read more

[Solved] IndentationError: unindent does not match any outer indentation level I do not understand anything [closed]

I diagrammed your code. See how the line that’s throwing an error doesn’t line up with any previous indentations? Python doesn’t know what to do with that, so it throws an error. In general, try and make your indentations always the same number of spaces, to avoid this. Consider these two pieces of code: a … Read more

[Solved] How to get the sum and the names of all the users from all voice channels Disocrd?

You need to access the voice channel object. I recommend you use the voice channel’s id. The command could look as follows: @client.command(pass_context = True) async def vcmembers(ctx, voice_channel_id): #First getting the voice channel object voice_channel = discord.utils.get(ctx.message.server.channels, id = voice_channel_id) if not voice_channel: return await client.say(“That is not a valid voice channel.”) members = … Read more

[Solved] How do I make a custom discord bot @ someone that a person @ed in the command?

To mention a user you have to define it beforehand. You do this as follows: user = message.mentions[0] To mention the user you can either use f-strings or format. Based on the code above here is an example: @client.event # Or whatever you use async def on_message(message): user = message.mentions[0] if message.content.startswith(‘!best’): await message.channel.send(“Hello, {}”.format(user.mention)) … Read more

[Solved] Uploading a file in a embed discord.py (not a image)

if you want to put the file in an embed, that is not possible, discord themselves haven’t allowed for that. You can send a file and a message at the same time. Here’s how: @client.command() async def name(ctx): embed = discord.Embed(colour=0x00000) embed.title = f”your title” embed.description = f”your desc” await ctx.send(embed=embed) await ctx.file.send(“filename.txt”) 0 solved … Read more

[Solved] How can i use discordpy cooldown command for client = discord.Client() [closed]

Also client = discord.Client() will not work. Use client = commands.Bot(command_prefix=prefix, intents=intents) Cooldowns are only for commands. Put this under a command – @commands.command() or @client.command: @commands.cooldown(uses, cooldown_time, commands.BucketType.user) e.g. @commands.cooldown(1, 30, commands.BucketType.user) Source: Cooldown For Command On Discord Bot Python 1 use per user and cooldown time is 30s If you don’t want that. … Read more

[Solved] Discord.Py / Bot was working great at first. Now the bot is live but when I try to give a command, Nothing happens and it doesnt show any error

Discord.Py / Bot was working great at first. Now the bot is live but when I try to give a command, Nothing happens and it doesnt show any error solved Discord.Py / Bot was working great at first. Now the bot is live but when I try to give a command, Nothing happens and it … Read more