示例#1
0
文件: Program.cs 项目: Qizzok/DSBot
 private async Task _client_ReactionRemoved(Cacheable <IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction)
 {
     if (channel.Id.Equals(DiscordIds.GetId("ROLES")))
     {
         foreach (Emotes.RoleEmote RE in Emotes.RoleEmoteList)
         {
             if (reaction.Emote.Name.Equals(RE.emote.Name))
             {
                 await(reaction.User.Value as IGuildUser).RemoveRoleAsync((channel as IGuildChannel).Guild.Roles.Where(y => y.Id.Equals(RE.role.id)).Single());
                 break;
             }
         }
     }
 }
示例#2
0
文件: Program.cs 项目: Qizzok/DSBot
        private async Task HandleCommand(SocketMessage arg)
        {
            SocketUserMessage message = arg as SocketUserMessage;

            if (message == null || arg.Author.IsBot || !(message.Channel is IGuildChannel && (message.Channel as IGuildChannel).GuildId == DiscordIds.GetId("SERVER")))
            {
                return;
            }
            int argPos = 0;

            if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos)))
            {
                return;
            }
            var context = new CommandContext(_client, message);
            var result  = await _commands.ExecuteAsync(context, argPos, _services);
        }