private void _Bu_AddGiff_Click(object sender, EventArgs e) { if (_TB_GiffKeys.Text != "" && _TB_GiffPath.Text != "") { if (!MemeList.ContainsKey(_TB_GiffKeys.Text) && !MemeList.ContainsValue(_TB_GiffPath.Text)) { if (File.Exists(PathGetter.GetMemePath(_TB_GiffPath.Text))) { MemeList.Add(_TB_GiffKeys.Text.ToLower(), _TB_GiffPath.Text); _LB_GiffList.Items.Add(_TB_GiffKeys.Text.ToLower() + "-:-" + _TB_GiffPath.Text); } else { MessageBox.Show("that file does not exist"); } } else { MessageBox.Show("You have ether the file or the key already included"); } } else { MessageBox.Show("You have a blank field"); } }
/// <summary> /// adds a file to the sound board /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _Bu_SoundBoardSoundAdd_Click(object sender, EventArgs e) { if (_LB_SoundBoardCatagoryBinder.SelectedIndex != -1 && _TB_SoundBoardSouCat.Text != "" && _TB_SoundBoardSouFil.Text != "") { SBSound Temp = new SBSound((SBCatagories)_LB_SoundBoardCatagoryBinder.Items[_LB_SoundBoardCatagoryBinder.SelectedIndex], _TB_SoundBoardSouKey.Text, _TB_SoundBoardSouFil.Text); if (!_LB_SoundBoardSoundsBinder.Items.Contains(Temp) && File.Exists(PathGetter.GetSoundBoardPath(Temp.File))) { _LB_SoundBoardSoundsBinder.Items.Add(Temp); } else { MessageBox.Show("Can not Duplicate File or File does not exist in _SoundBoard_ folder"); } } _Client?.SoundBoardListUpDate.Invoke(); }
/// <summary> /// Play a set of sounds /// </summary> /// <param name="Join"></param> /// <param name="Args"></param> void SoundBoard(ulong ServerLight, Channel Chat, Channel Join, string[] Args) { if (Args.Count() < 2 || Args.Count() == 2 && Args[1].ToLower() == "list") { string NList = ""; foreach (SBCatagories s in SoundBoardBinding) { NList += "\n" + s.Key + " -> " + s.Desc; } Chat.SendMessage("Let me help you with a list!:kissing_heart:\nThere are " + SoundBoardBinding.Count + " tree(s) to pick from." + NList + "\n!@soundboard list [the tree] -> for more"); } else if (Args[1].ToLower() == "list" && SoundBoardBinding[Args[2].ToLower()] != null) { string NList = ""; foreach (SBSound s in SoundBoardBinding[Args[2]]) { NList += "\n" + s.Key; } Chat.SendMessage("Let me help you with a list!:kissing_heart:\nHere is the list for " + SoundBoardBinding[Args[2].ToLower()].Desc + "." + NList + "\n!@soundboard [the tree] [the key] -> to play"); } else if (Args.Count() == 3) { if (Join != null) { if (SoundBoardBinding[Args[1].ToLower()] != null && SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()] != null) { SendAudioFile(ServerLight, Join, PathGetter.GetSoundBoardPath(SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()][Rand.Next(SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()].Count)])); } else { Chat.SendMessage("Sorry but you may have to double check your tree or sound keys"); } } else { Chat.SendMessage("Sorry but you are not in a voice chat"); } } }
async void TestSendAudio(ulong ServerLight, Channel testout) { await SendAudioFileInternal(ServerLight, testout, PathGetter.GetSoundBoardPath("Recording.m4a")); }
/// <summary> /// useful admin tools /// </summary> /// <param name="e"></param> /// <returns></returns> private bool AdminTree(MessageEventArgs e) { string[] Args = ArgMaker(e.Message.Text.Remove(0, 2)); if (Args.Count() < 1) { return(false); } if (Args[0].ToLower() == "help") { e.Channel.SendMessage("Thanks for asking!:kissing_heart:\nFor Admin Commands.:cocktail:\n!#inviteme -> Generates a link to invite her to your server\n!#clean -> Cleans messages (tell it how many)\n!#broadcast -> Broadcast to all channels.\n!#bbroadcast -> Bold broadcast to all channels.\n!#onlinesayhi -> Should Say Hi when on you come online (off / on)"); } else if (Args[0].ToLower() == "inviteme") { e.Channel.SendMessage(":wave: Hello there! :wave: \nI am Kaname Chidori:kissing_heart:\nUse this link to invite me to your server:love_letter:\n" + @"https://discordapp.com/oauth2/authorize?&client_id=192361072039165953&scope=bot&permissions=194552229183750144"); } else if (Args[0].ToLower() == "broadcast") { if (e.User.ServerPermissions.Administrator) { string message = ""; for (int i = 1; i < Args.Length; i++) { message += Args[i] + " "; } foreach (Channel c in e.Server.TextChannels) { c.SendMessage(message); } } else { e.Channel.SendMessage("I am sorry but you do not have the clearance for this!:lock::gun:"); e.Channel.SendFile(PathGetter.GetImagePath("images3.jpg")); } } else if (Args[0].ToLower() == "bbroadcast") { if (e.User.ServerPermissions.Administrator) { string message = ""; for (int i = 1; i < Args.Length; i++) { message += Args[i] + " "; } foreach (Channel c in e.Server.TextChannels) { c.SendMessage("**" + message + "**"); } } else { e.Channel.SendMessage("I am sorry but you do not have the clearance for this!:lock::gun:"); e.Channel.SendFile(PathGetter.GetImagePath("images3.jpg")); } } else if (Args.Count() == 2 && Args[0].ToLower() == "clean") { if (e.User.ServerPermissions.Administrator) { Thread.Sleep(20); int num; if (int.TryParse(Args[1], out num)) { Task <Message[]> test = e.Channel.DownloadMessages(num); test.Wait(); if (test.IsCompleted) { Message[] ToDel = test.Result; for (int i = 1; i < ToDel.Length; i++) { ToDel[i].Delete(); } } } else { e.Channel.SendMessage("Tell me how many to remove and it will be done."); } } else { e.Channel.SendMessage("I am sorry but you do not have the clearance for this!:lock::gun:"); e.Channel.SendFile(PathGetter.GetImagePath("images3.jpg")); } } else if (Args.Count() == 2 && Args[0].ToLower() == "onlinesayhi") { if (e.User.ServerPermissions.Administrator) { if (Args[1].ToLower() == "off") { OnlineSayHi = false; } else if (Args[1].ToLower() == "on") { OnlineSayHi = true; } } else { e.Channel.SendMessage("I am sorry but you do not have the clearance for this!:lock::gun:"); e.Channel.SendFile(PathGetter.GetImagePath("images3.jpg")); } } else if (Args[0].ToLower() == "onlinesayhi") { e.Channel.SendMessage("Please tell me a state to go into after command (on / off)"); } else { return(false); } return(true); }
/// <summary> /// chat tree /// </summary> /// <param name="e"></param> /// <returns></returns> private bool ChatTree(MessageEventArgs e) { string[] Args = ArgMaker(e.Message.Text.Remove(0, 2)); if (Args.Count() < 1) { return(false); } if (Args[0] == "help") { e.Channel.SendMessage("Thanks for asking!:kissing_heart:\nFor chat Commands.:love_letter:\n!~slap -> slap a person(s)\n!~smite -> smite a person(s)\n!~meme list -> Gets key list\n!~meme [key] [Top words] [Bottom words]-> makes a meme"); } else if (Args[0].ToLower() == "meme") { if (Args.Count() == 2 && Args[1].ToLower() == "list") { string list = ""; foreach (KeyValuePair <string, string> p in Memes) { list += "\n-" + p.Key; } e.Channel.SendMessage("Thanks for asking!:kissing_heart:\nThere are " + Memes.Keys.Count + list + "\ntry\n!~meme [key] [Top words] [Bottom words]"); } else if (Args.Count() == 4 && Memes.ContainsKey(Args[1].ToLower())) { SendMeme(e, Args); } else { string list = ""; foreach (KeyValuePair <string, string> p in Memes) { list += "\n-" + p.Key; } e.Channel.SendMessage("Let me help you with a list!:kissing_heart:\nThere are " + Memes.Keys.Count + list + "\ntry\n!~meme [key] [Top words] [Bottom words]"); } } else if (Args.Count() > 1 && Args[0].ToLower() == "slap") { if (e.Message.MentionedUsers.Count() > 1) { string users = ""; foreach (User u in e.Message.MentionedUsers) { users += " " + u.Mention; } e.Channel.SendMessage(e.User.Mention + " circle slaps" + users + "!"); } else if (e.Message.MentionedUsers.Count() > 0 && e.Message.MentionedUsers?.First()?.Name == e.User.Name) { e.Channel.SendMessage(e.User.Mention + " slaps him self."); } else if (e.Message.MentionedUsers.Count() > 0) { e.Channel.SendMessage(e.User.Mention + " slaps " + e.Message.MentionedUsers.First().Mention + "!"); } else { e.Channel.SendMessage(e.User.Mention + " slaps but misses!"); } } else if (Args[0].ToLower() == "smite") { if (e.Message.MentionedUsers.Count() > 1) { string users = ""; foreach (User u in e.Message.MentionedUsers) { users += " " + u.Mention; } e.Channel.SendFile(PathGetter.GetImagePath("Smite.jpg")); Thread.Sleep(20); e.Channel.SendMessage(e.User.Mention + " multi smites " + users + " with the power of a thousand paper fans!"); } else if (e.Message.MentionedUsers.Count() > 0 && e.Message.MentionedUsers?.First()?.Name == e.User.Name) { e.Channel.SendFile(PathGetter.GetImagePath("Smite.jpg")); Thread.Sleep(20); e.Channel.SendMessage(e.User.Mention + " Smites him self with the power of a thousand paper fans!"); } else if (e.Message.MentionedUsers.Count() > 0) { e.Channel.SendFile(PathGetter.GetImagePath("Smite.jpg")); Thread.Sleep(20); e.Channel.SendMessage(e.User.Mention + " Smites " + e.Message.MentionedUsers.First().Mention + " with the power of a thousand paper fans!"); } else { e.Channel.SendFile(PathGetter.GetImagePath("Smite.jpg")); Thread.Sleep(20); e.Channel.SendMessage(e.User.Mention + " Smites with a paper fan, but misses!"); } } //else if (Args[0].ToLower() == "chat") //{ // //TopTalk(e); //} else { return(false); } return(true); }
//async void TopTalk(MessageEventArgs e) //{ // CleverResponse Answer = await CleverResponder.Ask(e.Message.Text.Remove(0, 7)); // if (Answer.bSuccess) // await e.Channel.SendMessage(Answer.Response); // else // ConsoleWrite(Answer.Status); //} async void SendMeme(MessageEventArgs e, string[] Args) { _Memer.DrawText(Args[2], Args[3], PathGetter.GetMemePath(Memes[Args[1].ToLower()])).Save(PathGetter.TempImage); await e.Channel.SendFile(PathGetter.TempImage); }