Exemple #1
0
            public async Task Init()
            {
                InteractProcessBuilder IPB = new InteractProcessBuilder("LFG Configure")
                                             .WithStep("What Category should the LFG channels be created under? (right click on a category and copy it's ID. say `create one` and I'll do it for you")
                                             .WithStep("What Role should I base the group role off of? (mention it)")
                                             .WithStep("Should I create a text channel for each group? (reply with `yes` or `no`)")
                                             .WithStep("Should I create a voice channel for each group? (reply with `yes` or `no`)")
                                             .WithStep("If a non group user joins a group channel, should I automatically add them to the group? (reply with `yes` or `no`)")
                ;

                await InteractProcess.BeginInteractionProcess(IPB.Build(), Context.User, Context.Channel);
            }
Exemple #2
0
        public async Task Purge()
        {
            InteractProcessBuilder IPB = new InteractProcessBuilder("Are you sure?")
                                         .WhenSuccessful(async(InteractProcess Process) =>
            {
                ServerModel m = ServerDb.Servers.First(x => x.ServerSnowflake == Context.Guild.Id);
                ServerDb.Remove(m);
                ServerDb.SaveChangesAsync();
                await Process.Channel.SendMessageAsync("Purged");
            })
                                         .WhenCancelled(async(InteractProcess Process) => await Process.Channel.SendMessageAsync("Cancelled"))
                                         .WithStep("Are you sure? (say `cancel` to cancel)");


            await InteractProcess.BeginInteractionProcess(IPB.Build(), Context.User, Context.Channel);
        }
Exemple #3
0
        public async Task Setup()
        {
            ServerModel ServerDataObject = new ServerModel();

            ServerDataObject.ServerGUID      = Guid.NewGuid();
            ServerDataObject.Owner           = Context.Guild.OwnerId;
            ServerDataObject.ServerSnowflake = Context.Guild.Id;


            InteractProcessBuilder IPB = new InteractProcessBuilder("Server Configure")
                                         .WithUserObject(ServerDataObject)
                                         .WithDefaultStepCallback(async(SocketMessage Message, InteractProcess Process, InteractProcess.ProcessStep Step) =>
            {
                typeof(ServerModel).GetProperty(Step.UserObject as string).SetValue(Process.UserObject, Message.Content);
            })
                                         .WhenSuccessful(async(InteractProcess Process) =>
            {
                ServerDb.Servers.Add(Process.UserObject as ServerModel);
                ServerDb.SaveChangesAsync();
                await Process.Channel.SendMessageAsync("Done.  Your server is configured");
            })
                                         .WithStep("Describe your server", StepUserObject: nameof(ServerModel.Description))
                                         .WithStep("Ping your administrator roles (this role will be able to use admin commands, and you can mention multiple roles)"
                                                   , Callback: async(SocketMessage Message, InteractProcess Process, InteractProcess.ProcessStep Step) =>
            {
                ServerModel Model     = Process.UserObject as ServerModel;
                Model.ManagementRoles = Message.MentionedRoles.Select(x => new ManagementRole {
                    Role = x.Id
                }).ToList();
            })
                                         .WithStep("What is a channel I can post to for admin related messages?",
                                                   Callback: async(SocketMessage Message, InteractProcess Process, InteractProcess.ProcessStep Step) =>
            {
                if (Message.MentionedChannels.Count == 0)
                {
                    (Process.UserObject as ServerModel).AdminChannel = Message.Channel.Id;
                }
                (Process.UserObject as ServerModel).AdminChannel = Message.MentionedChannels.FirstOrDefault().Id;
            });

            await InteractProcess.BeginInteractionProcess(IPB.Build(), Context.User, Context.Channel);
        }