public async Task KickAsync(IGuildUser user, [Remainder] string reason = "No reason specified.") { var victim = user as SocketGuildUser; var author = Context.User as SocketGuildUser; if (Context.User.Id == user.Id) { await ReplyAsync("Just leave"); return; } if (victim.Hierarchy >= author.Hierarchy) { await ReplyAsync("You are not high enough in the Role Hierarchy to do that"); } else { await user.KickAsync(reason); UserKicked?.Invoke(this, new ModEventArgs() { OffendingUser = user, ResponsibleModerator = Context.User, Reason = reason }); await ReplyAsync("User " + user.Username + " has been kicked. Reason: " + reason); } }
public void OnUserKicked(string userName) { int index = users.FindIndex(u => u.IRCUser.Name == userName); if (index == -1) { return; } ChannelUser user = users[index]; if (user.IRCUser.Name == ProgramConstants.PLAYERNAME) { users.Clear(); } else { users.RemoveAt(index); } AddMessage(new ChatMessage(null, Color.White, DateTime.Now, userName + " has been kicked from " + UIName + ".")); UserKicked?.Invoke(this, new UserNameIndexEventArgs(index, userName)); }
public void OnUserKicked(string userName) { if (users.Remove(userName)) { if (userName == ProgramConstants.PLAYERNAME) { users.Clear(); } AddMessage(new ChatMessage(userName + " has been kicked from " + UIName + ".")); UserKicked?.Invoke(this, new UserNameEventArgs(userName)); } }
protected void OnUserKicked(UserInfo userInfo, string channel, string kickedNick) { UserKicked?.Invoke(userInfo, channel, kickedNick); }