Basically I want if someone types "whois (mention user)" the bot to send a message like "(user mentioned in first message) is (random message from array)" I just need to know 2 things How do I only send a message if it's an actual mentioned user and How do I set a variable something only if a certain user (my disc account) is mention
[Description("Mention someone after and it will tell you all about them")]
public async Task WhoIs(CommandContext ctx, [Description("Mention a User")] string name)
{ string[] descriptions = {"", "", "", "", ""};
Random rng = new Random();
int rngOk = rng.Next(descriptions.Length);
//if (name == "a certain user")
//{
// rngOk = 3;
//}
await ctx.Channel.SendMessageAsync(name + descriptions[rngOk]).ConfigureAwait(false);
}
This is my code so far If you need any additional information, just ask Any help would be appreciated
I don't know precisely what you are trying to ask, your question is very vague but I will do my best to answer it
First Question
For the first part of your question "How do I only send a message if it's an actual mentioned user", you need to have a DiscordUser parameter in your command like this
By doing this, when a user does "!help @RandomUser", the if statement will compare the ID of the mentioned user, to the ID of the user you set in the if statement
Second Question
Your second question "How do I set a variable something only if a certain user (my disc account) is mention", I don't understand properly. What are you trying to achieve here.
If we are mentioning your account as an example, why do you want to store it in a variable, if you are using it for something else it makes sense but once again your question is very vague
Once again you need the DiscordUser parameter in your command
From here on you can use this variable and access many different properties as you would normally like Id, Username etc