I want to make it so that, for example, when you ping a bot on discord, it will send a message like "type .ban"
in the same channel where he was pinged
Ginger2022-02-14 12:30:49I don `t understand. By ping do you mean the ping utility in the classical sense or something else?
V-Mor2022-02-14 12:30:49Ping is a discord functionality that allows you to send a request to a bot, for example, to check its performance. It has nothing to do with this utility.
BlueScreen2022-02-14 12:30:49-
Answer # 1
@bot.event async def on_message(message): if("<@!bot id>"in message.content): await message.channel.send('write .ban') await bot.process_commands(message)
please try to leave a little more detailed answers. You can add to your answer by clicking edit.
aleksandr barakin2022-02-13 22:32:26Well, at least the word boundary after id should be checked or something ...
Qwertiy2022-02-14 01:08:59 -
Answer # 2
@bot.event async def on_message(message): if("<@!bot id>"in message.content): await message.channel.send('write .ban') await bot.process_commands(message)
please try to leave a little more detailed answers. You can add to your answer by clicking edit.
aleksandr barakin2022-02-13 22:32:26Well, at least the word boundary after id should be checked or something ...
Qwertiy2022-02-14 01:08:59 -
Answer # 3
Opening off APIThey give an example of this code:
@bot.command() async def ping(ctx): await ctx.send('Pong!\n Latency {0}'.format(round(bot.latency, 1)))
Accordingly, in order for him to answer what you want, you need to:
@bot.command() async def ping(ctx): await ctx.send("Type .ban")
The quotation mark should be closed
dIm0n2022-02-14 12:30:49closed, thanks
BlueScreen2022-02-14 12:30:49There should be quotes of the same type :) Either only ' or only "
dIm0n2022-02-14 12:30:49 -
Answer # 4
Opening off APIThey give an example of this code:
@bot.command() async def ping(ctx): await ctx.send('Pong!\n Latency {0}'.format(round(bot.latency, 1)))
Accordingly, in order for him to answer what you want, you need to:
@bot.command() async def ping(ctx): await ctx.send("Type .ban")
The quotation mark should be closed
dIm0n2022-02-14 12:30:49closed, thanks
BlueScreen2022-02-14 12:30:49There should be quotes of the same type :) Either only ' or only "
dIm0n2022-02-14 12:30:49
- python : how to make it so that if the author's messages are above the bot role, then return?
- python : error in json file
- python : How to make a discord bot send a message to the chat every 10 seconds?
- Can't start python discord bot
- python : Discord bot won't start
- python : discord embed formatting
- python : Finding the server name DIscord.py
- python : Discord.py database
- python : Instead of one line, everything is deleted!
- python : How to make a discord message orange?
Where should he send this message?
V-Mor2022-02-14 12:30:49