コード例 #1
0
ファイル: UtilMethods.cs プロジェクト: filthfiend/Fifthbot
        public async Task AddGroupData(SocketCommandContext Context)
        {
            ulong userID = Context.User.Id;

            Command groupCommand = Vars.activeCommands.Where(x => x.ActorID == userID).FirstOrDefault();

            Console.WriteLine(" kink command data is -  " + groupCommand.CommandData);

            /*
             * Command kinkCommand = DataMethods.GetKinkAdder(Context.User.Id);
             */

            if (Context.Channel.Id != groupCommand.ChannelID)
            {
                return;
            }

            if (groupCommand.CommandData.Equals("start"))
            {
                string groupName = Context.Message.Content;

                groupCommand.CommandData = groupName;

                //await DataMethods.UpdateKinkAdder(kinkCommand.CommandID, kinkName );

                string newMessage = "Welcome " + Context.User.Mention + "\n" +
                                    "New Group Creation Step 2 - Enter Group Description:";

                ulong msgToEditID = groupCommand.MessageID;

                var msgToEdit = (RestUserMessage)await Context.Channel.GetMessageAsync(msgToEditID, CacheMode.AllowDownload);

                await msgToEdit.ModifyAsync(x => x.Content = newMessage);

                await Context.Message.DeleteAsync();
            }
            else
            {
                Console.WriteLine(" entering 2nd else  ");

                string groupDesc = Context.Message.ToString();
                string groupName = groupCommand.CommandData;

                Console.WriteLine(" attempting to add group  ");

                await DataMethods.AddGroup(groupName, groupDesc);

                Console.WriteLine(" group should be added  " + groupCommand.CommandData);

                // need to remove description message
                // need to remove command list entry

                await Context.Message.DeleteAsync();

                Vars.activeCommands.RemoveAll(x => x.ActorID == Context.User.Id && x.CommandName == "addgroup");


                ulong msgToDelID = groupCommand.MessageID;

                var msgToDel = (RestUserMessage)await Context.Channel.GetMessageAsync(msgToDelID);

                string newMessage = "Welcome " + Context.User.Mention + "\n" +
                                    "New group added - " + groupName + " - " + groupDesc;
                await msgToDel.ModifyAsync(x => x.Content = newMessage);
            }



            //return "fartz";
        }