public Task <Result> Execute(SocketUserMessage e, string username) { SocketGuildChannel channel = (e.Author as SocketGuildUser).VoiceChannel; SocketGuildUser user = Utility.FindUserByName((e.Channel as SocketGuildChannel).Guild, username); if (user == null) { return(TaskResult(false, "Error - User not found.")); } if (channel != null) { Voice.VoiceChannel vc = Voice.allVoiceChannels [channel.Id]; if (vc.IsLocked()) { if (vc.lockerID == e.Author.Id) { if (user.GuildPermissions.ManageChannels) { return(TaskResult(false, "Nice try, but you can't kick admins >:D.")); } vc.Kick(user); Program.messageControl.SendMessage(user, "Sorry man, but you have been kicked from voice channel **" + vc.GetName() + "**."); return(TaskResult(true, "User **" + Utility.GetUserName(user) + "** succesfully kicked.")); } return(TaskResult(false, "Only the person who locked this channel can do that, which is " + vc.GetLocker().Mention)); } return(TaskResult(false, "Error - The channel isn't locked.")); } return(TaskResult(false, "Error - Are you even in a channel?")); }
public Task Execute(SocketUserMessage e) { SocketGuildChannel channel = (e.Author as SocketGuildUser).VoiceChannel; if (channel != null) { Voice.VoiceChannel vc = Voice.allVoiceChannels [channel.Id]; if (vc.IsLocked()) { List <SocketGuildUser> foundUsers = new List <SocketGuildUser> (); string reply = "```\n"; foreach (ulong user in vc.allowedUsers) { SocketGuildUser u = Utility.GetServer().GetUser(user); foundUsers.Add(u); reply += Utility.GetUserName(u) + "\n"; } reply += "```"; return(TaskResult(foundUsers.ToArray(), "Users allowed on your locked channel:\n" + reply)); } return(TaskResult(null, "Error - The channel isn't locked.")); } return(TaskResult(null, "Error - Are you even in a channel?")); }
public async Task <Result> Execute(SocketUserMessage e, string name, string timespan) { TimeSpan timeSpan; if (Utility.TryParseSimpleTimespan(timespan, out timeSpan)) { Voice.VoiceChannel channel = await Voice.CreateTemporaryChannel(name, timeSpan); return(new Result(channel, "Succesfully created voice channel by name **" + name + "**!")); } else { return(new Result(null, "Failed to create voice channel - TimeSpan could not be parsed.")); } }
public Task <Result> Execute(SocketUserMessage e, SocketGuildUser user) { SocketGuildChannel channel = user.VoiceChannel; if (channel != null) { Voice.VoiceChannel vc = Voice.allVoiceChannels [channel.Id]; if (vc.IsLocked()) { vc.InviteUser(e.Author as SocketGuildUser, user); return(TaskResult(user, "User **" + Utility.GetUserName(user) + "** succesfully invited.")); } return(TaskResult(user, "The channel isn't locked, but I'm sure " + Utility.GetUserName(user) + " would love to join anyways.")); } return(TaskResult(null, "Failed to invite, are you even in a channel?")); }
public Task <Result> Execute(SocketUserMessage e) { SocketGuildChannel channel = (e.Author as SocketGuildUser).VoiceChannel; if (channel != null) { Voice.VoiceChannel vc = Voice.allVoiceChannels [channel.Id]; if (vc.IsLocked()) { if (vc.lockerID == e.Author.Id) { vc.Unlock(true); return(TaskResult(vc, "Succesfully unlocked voice channel **" + vc.GetName() + "**.")); } return(TaskResult(vc, "Only the person who locked this channel can do that, which is " + vc.GetLocker().Mention)); } return(TaskResult(vc, "Failed to unlock voice channel **" + vc.GetName() + "** - It is not unlocked.")); } return(TaskResult(null, "Failed to unlock channel, are you even in one?")); }
public Task <Result> Execute(SocketUserMessage e) { SocketGuildChannel channel = (e.Author as SocketGuildUser).VoiceChannel; if (channel != null) { Voice.VoiceChannel vc = Voice.allVoiceChannels [channel.Id]; if (!vc.IsLocked()) { if (!vc.lockable) { return(TaskResult(vc, "Error - cannot lock this channel due to *reasons*.")); } vc.Lock(e.Author.Id, true); return(TaskResult(vc, "Succesfully locked voice channel **" + vc.GetName() + "**.")); } return(TaskResult(vc, "Error - voice channel **" + vc.GetName() + "** already locked.")); } return(TaskResult(null, "Failed to lock channel, are you even in one?")); }