Esempio n. 1
0
        public async Task RemoveCommandAsync(
            [Summary("vim2meta")] CustomCmd command)
        {
            await _dbCustomCmds.DeleteOneAsync(command);

            await Context.ReplyAsync("You have successfully deleted this command.");
        }
Esempio n. 2
0
        public async Task ModifyCommandAsync(
            [Summary("vim2meta")] CustomCmd command,
            [Summary("RETARD THAT'S AS BLIND AS ME GRAN")][Remainder][MaxLength(Config.MAX_CMD_LENGTH)] CmdResponse response = null)
        {
            await _dbCustomCmds.UpdateAsync(command, x => x.Response = response.Value);

            await Context.ReplyAsync("You have successfully updated this command.");
        }
Esempio n. 3
0
        public async Task AddCommandAsync(
            [Summary("retarded")][UniqueCustomCmd] string name,
            [Summary("VIM2META LOL DUDE IS THICC AS BALLS")][Remainder][MaxLength(Config.MAX_CMD_LENGTH)] CmdResponse response)
        {
            var newCmd = new CustomCmd(Context.User.Id, Context.Guild.Id, name.ToLower(), response.Value);
            await _dbCustomCmds.InsertOneAsync(newCmd);

            await Context.ReplyAsync("You have successfully added a new custom command.");
        }
Esempio n. 4
0
 private void RefreshCustomList()
 {
     CustomListBox.Items.Clear();
     CustomCmd.CommandText = "SELECT Item FROM CustomList";
     reader = CustomCmd.ExecuteReader();
     while (reader.Read())
     {
         CustomListBox.Items.Add(reader["Item"].ToString());
     }
     reader.Close();
 }
Esempio n. 5
0
        private void AddCustomRecord(string obj)
        {
            CustomCmd.CommandText = "SELECT COUNT(Item) FROM CustomList WHERE Item = '" + obj + "'";
            long i = (long)CustomCmd.ExecuteScalar();

            if (i == 0)
            {
                CustomCmd.CommandText = "INSERT INTO CustomList (Item) VALUES ('" + obj + "')";
                CustomCmd.ExecuteNonQuery();
                CustomListBox.Items.Add(CustomAdderText.Text);
                CustomAdderText.Text = "";
            }
            else
            {
                MessageBox.Show("既に追加されている要素です。");
            }
        }
Esempio n. 6
0
 //接続
 private void ConnectDB()
 {
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\PlayerList.db"))
     {
         TeamCon = new SQLiteConnection(TeamDBPath);
         TeamCon.Open();
         TeamCmd = TeamCon.CreateCommand();
     }
     else
     {
         TeamCon = new SQLiteConnection(TeamDBPath);
         TeamCon.Open();
         TeamCmd             = TeamCon.CreateCommand();
         TeamCmd.CommandText = "CREATE TABLE PlayerList (id integer primary key, Player varchar)";
         TeamCmd.ExecuteNonQuery();
     }
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\CustomList.db"))
     {
         CustomCon = new SQLiteConnection(CustomDBPath);
         CustomCon.Open();
         CustomCmd = CustomCon.CreateCommand();
     }
     else
     {
         CustomCon = new SQLiteConnection(CustomDBPath);
         CustomCon.Open();
         CustomCmd             = CustomCon.CreateCommand();
         CustomCmd.CommandText = "CREATE TABLE CustomList (id integer primary key, Item varchar)";
         CustomCmd.ExecuteNonQuery();
     }
     BindCon = new SQLiteConnection("Data Source=" + @"DataLists\\SpecifiedBindList.db");
     BindCon.Open();
     BindCmd = BindCon.CreateCommand();
     JobCon  = new SQLiteConnection("Data Source=" + @"DataLists\\JobList.db");
     JobCon.Open();
     JobCmd  = JobCon.CreateCommand();
     TypeCon = new SQLiteConnection("Data Source=" + @"DataLists\\TypeList.db");
     TypeCon.Open();
     TypeCmd = TypeCon.CreateCommand();
     MapCon  = new SQLiteConnection("Data Source=" + @"DataLists\\MapList.db");
     MapCon.Open();
     MapCmd = MapCon.CreateCommand();
 }
Esempio n. 7
0
        public async Task CmdInfoAsync(
            [Summary("command")] CustomCmd cmd)
        {
            var elems = new List <(string, string)>()
            {
                ("Response", cmd.Response),
                ("Uses", cmd.Uses.ToString()),
                ("Created At", cmd.Timestamp.ToString("f")),
            };

            var creator = await Context.Client.GetUserAsync(cmd.OwnerId);

            if (creator != null)
            {
                elems.Insert(0, ("Creator", creator.ToString()));
            }

            await Context.SendAsync(string.Join("\n", elems.Select(x => $"{x.Item1.Bold()}: {x.Item2}")), cmd.Name.UpperFirstChar());
        }
Esempio n. 8
0
 private void RemoveCustomRecord(string obj)
 {
     CustomCmd.CommandText = "DELETE FROM CustomList WHERE Item = '" + obj + "'";
     CustomCmd.ExecuteNonQuery();
     RefreshCustomList();
 }