The bot sends a message "Do u like or dislike smth" and reacts :thumb-up: and :thumb-down:, then calculates how many people voted for each option. How can I do it? This is my code for now:
public Task Respects(SocketGuildUser user)
{
var emoji = new Emoji("👍");
Context.Channel.SendMessageAsync($"What do u think about {user.Mention}'s message?");
return Context.Message.AddReactionAsync(emoji);
}
And I don't completely understand how to add emoji reaction by text indificator (:thumb_up:).
I found the answer myself, there is my code:
[Command("respects"), Alias("F")]
[RequireBotPermission(GuildPermission.AddReactions)]
public async Task Respects(SocketGuildUser user)
{
var emoji = new Emoji("\uD83C\uDDEB");
string message = $"Press F to pay respects to {user.Mention}:";
var sent = await Context.Channel.SendMessageAsync(message);
await sent.AddReactionAsync(emoji);
}
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.