public async Task Unban([Remainder] string NazwaUżytkownika) { var bans = await Context.Guild.GetBansAsync(); var theUser = bans.FirstOrDefault(x => x.User.ToString().ToLowerInvariant() == NazwaUżytkownika.ToLowerInvariant()); await Context.Guild.RemoveBanAsync(theUser.User).ConfigureAwait(false); var embed = EmbedHandler.CreateEmbed("Odbanowałem :raised_hands: " + NazwaUżytkownika + " :raised_hands: na tym serwerze!", EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task Unmute([NoSelf] SocketGuildUser Użytkownik) { await Context.Guild.GetUser(Użytkownik.Id).ModifyAsync(x => x.Mute = false).ConfigureAwait(false); try { await Użytkownik.ModifyAsync(x => x.Mute = false).ConfigureAwait(false); } catch { } try { await Użytkownik.RemoveRoleAsync(await GetMuteRole(Użytkownik.Guild)).ConfigureAwait(false); } catch { } var embed = EmbedHandler.CreateEmbed("Odciszyłem użytkownika :loud_sound: " + Użytkownik + " :loud_sound: na tym serwerze!", EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task Unban(ulong IdUżytkownika) { var bans = await Context.Guild.GetBansAsync(); var theUser = bans.FirstOrDefault(x => x.User.Id == IdUżytkownika); await Context.Guild.RemoveBanAsync(theUser.User); var embed = EmbedHandler.CreateEmbed("Odbanowałem :raised_hands: " + IdUżytkownika + " :raised_hands: na tym serwerze!", EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task UpdateTag(string tagName, [Remainder] string tagContent) { var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); //tagContent.Replace("@everyone", "@\u200beveryone").Replace("@here", "@\u200bhere"); var response = TagFunctions.UpdateTag(tagName, tagContent, guildAcc); var embed = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task Update() { var version = Config.bot.version; var config = BotAccounts.GetAccount(); var embed = EmbedHandler.CreateEmbed(Context, "Update Notes", $"**<<Last Updated on {config.LastUpdate.ToShortDateString()}>>**\n`Version {version}`\n" + config.ChangeLog, EmbedHandler.EmbedMessageType.Success); await SendMessage(Context, embed); }
public async Task SetChangeLog([Remainder] string changeLog) { var config = BotAccounts.GetAccount(); config.ChangeLog = changeLog; config.LastUpdate = DateTime.Today; var embed = EmbedHandler.CreateEmbed(Context, "Update Change Log", $"Set the bot's changeLog to ```{changeLog}```", EmbedHandler.EmbedMessageType.Success); await SendMessage(Context, embed); }
public async Task UpdateIstrial(SocketUser user, [Summary("The current alt you have in World of Warcraft")][Remainder] string returning) { if (returning.ToLower() != "true" && returning.ToLower() != "false") { await ReplyAsync("Error: Accepted values: True / False"); } else { UserAccounts.AccountUpdate(user, returning, UserAccounts.UpdateType.IsTrial); await ReplyAsync("", false, EmbedHandler.CreateEmbed("Account Updated", $"**The Trial Status Has Been Set To: __{returning}__**", EmbedHandler.EmbedMessageType.Success, true)); } }
public async Task <Embed> GetQueueAsync(ShardedCommandContext context) { if (!_lavaNode.TryGetPlayer(context.Guild, out var player)) { return(EmbedHandler.CreateEmbed(context, "Music Queue", $"{Global.ENo} | I'm not connected to a voice channel.", EmbedHandler.EmbedMessageType.Error)); } if (player.PlayerState != PlayerState.Playing) { return(EmbedHandler.CreateEmbed(context, "Music Queue", $"{Global.ENo} | There's nothing playing at the moment", EmbedHandler.EmbedMessageType.Error)); } var currentTrack = player.Track; var artwork = await currentTrack.FetchArtworkAsync(); var descriptionBuilder = new StringBuilder(); if (player.Queue.Count < 1 && player.PlayerState != PlayerState.Playing) { string title = currentTrack.Title; return(EmbedHandler.CreateEmbed(context, $"Now Playing: **{title}**", "There are no other items in the queue.", EmbedHandler.EmbedMessageType.Success)); } var trackNum = 2; foreach (LavaTrack track in player.Queue.Items) { if (trackNum == 2) { descriptionBuilder.Append($"Up Next: **[{track.Title}]** - ({track.Duration})\n\n"); trackNum++; } else { descriptionBuilder.Append($"#{trackNum}: **[{track.Title}]** - ({track.Duration})\n\n"); trackNum++; } } var embed = new EmbedBuilder { Title = $"Queue", ThumbnailUrl = artwork, Description = $"Now Playing: [{player.Track.Title}]({player.Track.Duration})\n\n{descriptionBuilder}", Color = Global.NayuColor }; return(embed.Build()); }
public async Task Mute(SocketGuildUser Użytkownik) { await Context.Guild.GetUser(Użytkownik.Id).ModifyAsync(x => x.Mute = true); var muteRole = await GetMuteRole(Użytkownik.Guild); if (!Użytkownik.Roles.Any(r => r.Id == muteRole.Id)) { await Użytkownik.AddRoleAsync(muteRole).ConfigureAwait(false); } var embed = EmbedHandler.CreateEmbed("Wyciszyłem użytkownika :mute: " + Użytkownik + " :mute: na tym serwerze!", EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); }
public async Task <Embed> SetVolume(SocketGuildUser user, IMessageChannel channel, int volume) { LavaPlayer player = lavalink.DefaultNode.GetPlayer(Config.Bot.ServerID); if (player.VoiceChannel != null) { await player.SetVolumeAsync(volume); return(await EmbedHandler.CreateEmbed("Audio", string.Format("{0} changed volume to {1}.", user.Username, volume.ToString()))); } else { return(await EmbedHandler.CreateErrorEmbed("Audio, Volume", "Not In a Voice Channel.")); } }
public async Task <Embed> ListQueue(SocketGuildUser user, IMessageChannel channel) { LavaPlayer player = lavalink.DefaultNode.GetPlayer(Config.Bot.ServerID); player.TextChannel = channel; string trackTitles = "Currently Playing: " + player.CurrentTrack.Title + "\n\n"; foreach (LavaTrack track in player.Queue.Items) { trackTitles += string.Format("• {0} | {1}\n\n", track.Title, track.Length); } return(await EmbedHandler.CreateEmbed("Audio", trackTitles)); }
public async Task <Embed> LoopTrack(SocketGuildUser user, IMessageChannel channel) { LavaPlayer player = lavalink.DefaultNode.GetPlayer(Config.Bot.ServerID); Loop = !Loop; if (Loop) { return(await EmbedHandler.CreateEmbed("Audio", "Loop has been turned on.")); } else { return(await EmbedHandler.CreateEmbed("Audio", "Loop has been turned off.")); } }
public async Task Prefix(string prefix) { var editSettingsResult = BotSettings.SetCommandPrefix(prefix); if (editSettingsResult.Success) { var embed = EmbedHandler.CreateEmbed("Prefix", "New prefix set", EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); } else { var embed = EmbedHandler.CreateEmbed("Prefix", editSettingsResult.Alerts.FirstOrDefault().Description, EmbedHandler.EmbedMessageType.Success); await Context.Channel.SendMessageAsync("", false, embed); } }
public async Task SetChannelToBeIgnoredByFilter(string type, SocketGuildChannel chnl = null) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.Administrator) { string description = $"{Global.ENo} **|** You Need the **Administrator** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithColor(Global.NayuColor); switch (type) { case "add": case "Add": config.NoFilterChannels.Add(chnl.Id); embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Filter."); break; case "rem": case "Rem": config.NoFilterChannels.Remove(chnl.Id); embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Filter."); break; case "clear": case "Clear": config.NoFilterChannels.Clear(); embed.WithDescription("List of channels to be ignored by Filter has been cleared."); break; default: embed.WithDescription( $"Valid types are `add`, `rem`, and `clear`. Syntax: `n!fi {{add/rem/clear}} [channelMention]`"); break; } GlobalUserAccounts.SaveAccounts(Context.Guild.Id); await SendMessage(Context, embed.Build()); }
public async Task AddXP(uint xp, IGuildUser user, [Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccount = GlobalUserAccounts.GetUserAccount((SocketGuildUser)user); userAccount.XP += xp; GlobalGuildUserAccounts.SaveAccounts(); var embed = EmbedHandler.CreateEmbed(Context, "Success!", $"✅ **|** **{xp}** xp were added to {target.Username}'s account.", EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task RateWaifu([Remainder] string input) { var vowels = Regex.Replace(input, "[bcdfghjklmnpqrstvwxyz]", "", RegexOptions.IgnoreCase).GetHashCode(); var consonants = Regex.Replace(input, "[aeiou]", "", RegexOptions.IgnoreCase).GetHashCode(); Console.WriteLine(consonants); var secret1 = int.Parse(consonants.ToString().Substring(1, 1)); Console.WriteLine(secret1); var secret2 = vowels.ToString().Substring(1, Math.Abs(6 - int.Parse(vowels.ToString()[secret1].ToString()))); var rating = Math.Round(Math.Sin(Math.Abs(Math.Cos(int.Parse(secret2)))) * 100); var embed = EmbedHandler.CreateEmbed(Context, "Rate Waifu", $"I'd rate {input} a **{rating} / 100**", EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task Echo([Remainder] string message) { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); if (config.MassPingChecks) { if (message.Contains("@everyone") || message.Contains("@here")) { return; } } var embed = EmbedHandler.CreateEmbed(Context, "Echo!", message, EmbedHandler.EmbedMessageType.Success); await SendMessage(Context, embed); }
public async Task <Embed> JoinOrPlay(SocketGuildUser user, IMessageChannel channel, string query = null) { if (user.VoiceChannel == null) { return(await EmbedHandler.CreateErrorEmbed("Audio, Join/Play", "You Need To Be In a Voice Channel.")); } await lavalink.DefaultNode.ConnectAsync(user.VoiceChannel); if (query != null) { LavaPlayer player = lavalink.DefaultNode.GetPlayer(Config.Bot.ServerID); player.TextChannel = channel; IUserMessage message = await player.TextChannel.SendMessageAsync("Searching..."); LavaTrack track; LavaResult search = await lavalink.DefaultNode.SearchYouTubeAsync(query); if (search.LoadResultType == LoadResultType.NoMatches) { await message.DeleteAsync(); return(await EmbedHandler.CreateErrorEmbed("Audio, Query", "There Were No Query Results.")); } else { track = search.Tracks.FirstOrDefault(); await message.DeleteAsync(); if (player.CurrentTrack != null && player.IsPlaying || player.IsPaused) { player.Queue.Enqueue(track); return(await EmbedHandler.CreateEmbed("Audio", string.Format("{0} has been added to the queue.", track.Title))); } else { await player.PlayAsync(track); return(await EmbedHandler.CreateEmbed("Audio", string.Format("Now Playing: {0}.", track.Title))); } } } return(await EmbedHandler.CreateEmbed("Audio", "Joined voice channel " + user.VoiceChannel + ".")); }
public async Task WarnUser([NoSelf] IGuildUser user, [Remainder] string reason = "No reason provided.") { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.ManageMessages) { string description = $"{Global.ENo} **|** You Need the **Manage Messages** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } if (user == null) { var embed = EmbedHandler.CreateEmbed(Context, "Error", "🖐️ **|** Please say who you want to warn and a reason for their warning. Ex: n!warn @Phytal bullied my brother", EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : embed); } var userAccount = GlobalGuildUserAccounts.GetUserID((SocketGuildUser)user); var dmChannel = await user.GetOrCreateDMChannelAsync(); try { var dmDesc = $"You have been warned in **{Context.Guild.Name}** for:\n {reason}\nYou now have Warning{(userAccount.NumberOfWarnings == 1 ? "" : "s")}"; var dmEmbed = EmbedHandler.CreateEmbed(Context, "Warning", dmDesc, EmbedHandler.EmbedMessageType.Info, false); await dmChannel.SendMessageAsync("", embed : dmEmbed); } catch (Exception) { //nothing should happen and it doesn't matter if anything does happen } userAccount.NumberOfWarnings++; userAccount.Warnings.Add(reason); GlobalGuildUserAccounts.SaveAccounts(); var desc = $"Successfully warned **{user.Username}** for **{reason}**. **({userAccount.NumberOfWarnings} Warning{(userAccount.NumberOfWarnings == 1 ? "" : "s")})**"; var successEmbed = EmbedHandler.CreateEmbed(Context, "Warning", desc, EmbedHandler.EmbedMessageType.Success); await SendMessage(Context, successEmbed); }
public async Task AddPoints(uint Points, SocketGuildUser user, [Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccount = GlobalGuildUserAccounts.GetUserID(user); userAccount.Reputation += Points; GlobalGuildUserAccounts.SaveAccounts(); var embed = EmbedHandler.CreateEmbed(Context, "Success!", $"✅ **|** **{Points}** reputation points were added to {target.Username}'s account.", EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task SetAvatar(string link) { try { var webClient = new WebClient(); byte[] imageBytes = webClient.DownloadData(link); var stream = new MemoryStream(imageBytes); var image = new Image(stream); await Context.Client.CurrentUser.ModifyAsync(k => k.Avatar = image); } catch (Exception) { var embed = EmbedHandler.CreateEmbed(Context, "Avatar", "Could not set the avatar!", EmbedHandler.EmbedMessageType.Exception); await SendMessage(Context, embed); } }
public async Task UnmuteAsync(SocketGuildUser user = null) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.ManageRoles) { string description = $"{Global.ENo} **|** You Need the **Manage Roles** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } try { try { await user.ModifyAsync(x => x.Mute = false).ConfigureAwait(false); } catch { } try { await user.RemoveRoleAsync(await GetMuteRole(user.Guild)).ConfigureAwait(false); } catch { } var muted = user.Guild.Roles.Where(input => input.Name.ToUpper() == "MUTED").FirstOrDefault() as SocketRole; await ReplyAsync("✅ **|** " + Context.User.Mention + " unmuted " + user.Username); } catch { await ReplyAsync("🖐️ **|** You must mention a valid user that is muted"); } }
public async Task ShowTag(string tagName) { if (string.IsNullOrWhiteSpace(tagName)) { var description = "You need to use this with some more input...\n" + "Try the `n!command tag` command to get more information on how to use this command."; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error!", description, EmbedHandler.EmbedMessageType.Exception, false); await SendMessage(Context, errorEmbed); return; } var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var response = TagFunctions.GetTag(tagName, guildAcc); var embed = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task GetRandomNekoLewd() { var channel = Context.Channel as ITextChannel; if (!channel.IsNsfw) { var nsfwText = $"{Global.ENo} **|** You need to use this command in a NSFW channel, {Context.User.Username}!"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", nsfwText, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } int rand = Global.Rng.Next(1, 3); if (rand == 1) { string nekoLink = NekosLifeHelper.GetNekoLink("lewd"); string description = "Randomly generated lewd neko just for you <3!"; var embed = ImageEmbed.GetImageEmbed(nekoLink, Source.NekosLife, description); await SendMessage(Context, embed); } if (rand == 2) { string[] tags = { "" }; WebRequest webReq = new WebRequest(); RandomData result = await webReq.GetTypesAsync("neko", tags, FileType.Any, NsfwSearch.Only, false); string url = result.Url; //string id = result.Id; string description = "Randomly generated lewd neko just for you <3!"; var embed = ImageEmbed.GetImageEmbed(url, Source.WeebDotSh, description); await SendMessage(Context, embed); } }
public async Task Purge([Remainder] int num = 0) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.ManageMessages) { string description = $"{Global.ENo} **|** You Need the **Manage Messages** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } if (num <= 100) { var messagesToDelete = await Context.Channel.GetMessagesAsync(num + 1).FlattenAsync(); if (Context.Channel is ITextChannel channel) { await channel.DeleteMessagesAsync(messagesToDelete); } if (num == 1) { await ReplyAndDeleteAsync("✅ **|** Deleted 1 message."); } else { await ReplyAndDeleteAsync("✅ **|** Cleared " + num + " messages.", timeout : TimeSpan.FromSeconds(5)); } } else { var embed = new EmbedBuilder(); embed.WithColor(Global.NayuColor); embed.Title = "{Global.ENo} **|** You cannot delete more than 100 messages at once!"; await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5)); } }
public async Task GetRandomClassic() { var channel = Context.Channel as ITextChannel; if (!channel.IsNsfw) { var nsfwText = $"{Global.ENo} **|** You need to use this command in a NSFW channel, {Context.User.Username}!"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", nsfwText, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } string nekoLink = NekosLifeHelper.GetNekoLink("classic"); var title = "Randomly generated classic hentai just for you <3!"; var embed = ImageEmbed.GetImageEmbed(nekoLink, Source.NekosLife, title); await SendMessage(Context, embed); }
public async Task LewdImgChannel(ITextChannel channel) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.Administrator) { var description = $"{Global.ENo} **|** You Need the Administrator Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); guildAcc.AutoLewdChannel = channel.Id; GlobalGuildAccounts.SaveAccounts(Context.Guild.Id); await ReplyAsync("The AutoLewd-Channel has been set to " + channel.Mention); }
public async Task GetPrefixForServer() { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); string prefix; switch (config) { case null: prefix = "n!"; break; default: prefix = config.CommandPrefix; break; } var embed = EmbedHandler.CreateEmbed(Context, "Prefix", $"The prefix for this server is {prefix}.", EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task ReturningMembers() { var descriptionBuilder = new StringBuilder(); var returningPlayers = UserAccounts.GetReturningMemebers(); var returningDPS = UserAccounts.GetSpec(UserAccounts.SpecType.DPS); var returningHealers = UserAccounts.GetSpec(UserAccounts.SpecType.Healer); var returningTanks = UserAccounts.GetSpec(UserAccounts.SpecType.Tank); var trials = UserAccounts.GetTrials(); foreach (var player in returningPlayers) { descriptionBuilder.Append($"``{player.MainChar}`` "); } await ReplyAsync("", false, EmbedHandler.CreateEmbed( "Returning Players For Next Tier", $"{descriptionBuilder.ToString()} " + $"\n\n We currently have **__{returningPlayers.Count}/20__** Players." + $"\n Current Setup: **__{returningTanks.Count}/{returningHealers.Count}/{returningDPS.Count}__**\n\n" + $"Tanks Needed: {2 - returningTanks.Count}\n" + $"Healers Needed: {4 - returningHealers.Count}\n" + $"DPS Required: {14 - returningDPS.Count}\n\n" + $"We Current Have {trials.Count} Trial Raiders.", EmbedHandler.EmbedMessageType.Info, true)); }
public async Task AddStringToBl([Remainder] string word) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.Administrator) { string description = $"{Global.ENo} **|** You Need the **Administrator** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); await SendMessage(Context, null, $"✅ **|** Added **{word}** to the Blacklist."); config.CustomFilter.Add(word); GlobalGuildAccounts.SaveAccounts(Context.Guild.Id); }