From d8944c600d168ac3da4c0acebf4eae5491038d20 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 10 Sep 2017 15:11:42 -0400 Subject: Added project files --- AleeChat for Discord Bots/DiscordBot.cs | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 AleeChat for Discord Bots/DiscordBot.cs (limited to 'AleeChat for Discord Bots/DiscordBot.cs') diff --git a/AleeChat for Discord Bots/DiscordBot.cs b/AleeChat for Discord Bots/DiscordBot.cs new file mode 100644 index 0000000..a029038 --- /dev/null +++ b/AleeChat for Discord Bots/DiscordBot.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Discord; +using Discord.WebSocket; + +namespace AleeChat_for_Discord_Bots +{ + public partial class DiscordBot : Form + { + DiscordSocketClient Client; + + public DiscordBot() + { + InitializeComponent(); + } + + private void exitButton_Click(object sender, EventArgs e) + { + + } + + private void guildComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + channelBox.Items.Clear(); + + foreach(var Guild in Client.Guilds) + { + if(Guild.Name == guildComboBox.Text) + { + foreach(var Tc in Guild.TextChannels) + { + channelBox.Items.Add(Tc.Name); + } + } + } + } + + private async void loginButton_Click(object sender, EventArgs e) + { + Client = new DiscordSocketClient(new DiscordSocketConfig() + { + LogLevel = LogSeverity.Verbose + }); + + Client.Log += Client_Log; + + try + { + await Client.LoginAsync(TokenType.Bot, tokenBox.Text); + await Client.StartAsync(); + } + catch + { + MessageBox.Show("Error occured while connecting your Bot!", "ERROR"); + return; + } + await Task.Delay(3000); + + foreach (var Guild in Client.Guilds) + { + guildComboBox.Items.Add(Guild.Name); + } + + guildComboBox.SelectedIndexChanged += guildComboBox_SelectedIndexChanged; + } + + private Task Client_Log(LogMessage arg) + { + Invoke((Action)delegate + { + discordConsole.AppendText(arg + "\n"); + }); + return null; + } + + private void discordConsole_TextChanged(object sender, EventArgs e) + { + + } + + private void tokenBox_TextChanged(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + + private void sendButton_Click(object sender, EventArgs e) + { + + } + } +} -- cgit v1.2.3