public async Task <EventHandlerResult> Handle(MessageReactionAddEventArgs eventArgs) { // https://discordapp.com/channels/366970031445377024/507515506073403402/686745124885364770 if (!(eventArgs.Message.Id == _config.VerificationMessageId && eventArgs.Message.ChannelId == _config.VerificationChannelId)) { return(EventHandlerResult.Continue); } if (!eventArgs.Emoji.Name.Equals(_config.VerificationEmojiName)) { return(EventHandlerResult.Continue); } DiscordUser user = eventArgs.User; DiscordDmChannel channel = await eventArgs.Guild.Members[user.Id].CreateDmChannelAsync(); string link = _urlProvider.GetAuthLink(user.Id, RolesPool.Auth); if (await _authorizationService.IsUserVerified(user.Id)) { await channel.SendMessageAsync( $"Ahoj, už jsi ověřený.\nPro aktualizaci rolí dle UserMap klikni na odkaz: {link}"); } else { await channel.SendMessageAsync( $"Ahoj, pro ověření a přidělení rolí dle UserMap klikni na odkaz: {link}"); } return(EventHandlerResult.Stop); }
public async Task AuthorizeCommand(CommandContext ctx) { DiscordMessage message = ctx.Message; DiscordUser user = message.Author; DiscordDmChannel channel = await message.Channel.Guild.Members[user.Id].CreateDmChannelAsync(); string link = _urlProvider.GetAuthLink(user.Id, RolesPool.Auth); if (await _authorizationService.IsUserVerified(user.Id)) { await channel.SendMessageAsync( $"You are already authorized.\nTo update roles follow this link: {link}"); } else { await channel.SendMessageAsync($"Hi, authorize by following this link: {link}"); } }
public async Task <IReactionHandler.Result> HandleAddAsync(MessageReactionAddEventArgs eventArgs) { // https://discordapp.com/channels/366970031445377024/507515506073403402/686745124885364770 if (!(eventArgs.Message.Id == _config.VerificationMessageId && eventArgs.Message.ChannelId == _config.VerificationChannelId)) { return(IReactionHandler.Result.Continue); } if (!eventArgs.Emoji.Name.Equals(_config.StaffVerificationEmojiName)) { return(IReactionHandler.Result.Continue); } DiscordUser user = eventArgs.User; DiscordDmChannel channel = await eventArgs.Guild.Members[user.Id].CreateDmChannelAsync(); string link = _urlProvider.GetAuthLink(user.Id, RolesPool.Staff); await channel.SendMessageAsync($"Ahoj, pro získání rolí zaměstnance klikni na: {link}"); return(IReactionHandler.Result.Stop); }