Let's say that this is the intro embed for every new bot user:
Let's say that there are commands like BEG, HELP, WORK and all these many commands that this bot supports... But if you are a new bot user and you type '(prefix) beg' you WON'T beg, instead, you will get this embed shown above because you are new. And after that you can use the bot normally...
Can you use something along the lines of:
@client.event
async def on_new_user():
await ctx.send(embed=introduction_embed)
Or is there a different way? How do I ensure that every user saw this intro embed before anything and make sure that they only see it ONCE? I am working on a discord bot using python. Would appreciate some help! Thanks so much
Something like this:
on_command
is run when a command is found, if I decorate it with before_invoke
I can raise an error after sending the embed, preventing the command from running the first time for each user. It's up to you how to store the users though.
The CommandError is caught and passed into on_command_error
event.
registered_users = []
@bot.before_invoke
@bot.event
async def on_command(ctx):
global registered_users
if ctx.author not in registered_users:
registered_users.append(ctx.author)
embed = discord.Embed(
color=discord.Colour.random(),
title="WELCOME",
description="welcome message",
)
await ctx.send(embed=embed)
raise commands.CommandError("Error")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.