Exemplo n.º 1
0
        public static async Task VerifyUserAsync(Cacheable <IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction)
        {
            try
            {
                if (DiscordContextOverseer.GetNoobGateChannel().Id == channel.Id)
                {
                    if (message.Id == DiscordContextSeymour.GetNoobGateWelcome().Id)
                    {
                        if (reaction.Emote.Name == DiscordContextOverseer.GetEmotePommel().Name)
                        {
                            SocketGuildUser user = reaction.User.Value as SocketGuildUser;

                            if (user != null)
                            {
                                var roleToRemove = DiscordContextOverseer.GrabRole(MordhauRoleEnum.Peasant);
                                if (user.Roles.Any(x => x.Id == roleToRemove.Id) || roleToRemove != null)
                                {
                                    await user.RemoveRoleAsync(roleToRemove);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ErrMessages.UserVerifyException, ex);
            }
        }
Exemplo n.º 2
0
 public static async Task ApplyPeasantRoleAsync(SocketGuildUser user)
 {
     try
     {
         await user.AddRoleAsync(DiscordContextOverseer.GrabRole(MordhauRoleEnum.Peasant));
     }
     catch (Exception ex)
     {
         ExceptionManager.HandleException($"{typeof(RoleApplication).GetType().FullName}: {ExceptionManager.GetAsyncMethodName()}", ex);
     }
 }