Пример #1
0
 /// <summary>
 /// simple disconect button event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _Bu_Disconnect_Click(object sender, EventArgs e)
 {
     // just disconnect if not null and house clean
     _Client?._DiscordClient?.Disconnect();
     _Client?._DiscordClient?.Dispose();
     _Client = null; // set the old client for clean up and neatly nulled
 }
Пример #2
0
        /// <summary>
        /// executes command
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _Bu_Excute_Click(object sender, EventArgs e)
        {
            _RTB_ConsoleOut.AppendText("User : "******"\n");

            string[] args = DiscordBotWorker.ArgMaker(_TB_CommandPrompt.Text);
            if (args[0].ToLower() == "sim" && _Client != null)
            {
                _Client.MasterAndCommander.Invoke(args);
            }
            else if (args[0].ToLower() == "help")
            {
                _RTB_ConsoleOut.AppendText("There are these commands\nsim [server] [channel] <order strings>-> sends a sim message to discord though the bot");
            }
        }
Пример #3
0
        /// <summary>
        /// basic button connect event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _Bu_Connect_Click(object sender, EventArgs e)
        {
            // first check if we have a connection as it would be redundent to do if we have one
            // also to prevent hanging memory
            if (_Client != null)
            {
                return;                  //if not null simply return
            }
            //quickly build a array of values from the listbox
            string[] temp = new string[_LB_GamesToPlay.Items.Count + 1];
            temp[0] = null; // we dont aways play games so leave a null for if we dont
            int i = 1;      // start one off as well the extra is null

            foreach (string s in _LB_GamesToPlay.Items)
            {
                temp[i] = s;
                i++;
            }

            // connect using this as the control and with the array of games
            _Client = new DiscordBotWorker(this, temp, SoundBindings);
            Thread.Sleep(200);
        }