예제 #1
0
        public async Task InitialiseWelcome()
        {
            await ReplyAsync("```\n" +
                             "Reply with the command you would like to perform\n" +
                             "[1] Set the welcome message\n" +
                             "[2] Set the current channel for welcome events\n" +
                             "[3] Enable the welcome event\n" +
                             "[4] Disable the welcome event\n" +
                             "[5] View Welcome Info" +
                             "" +
                             "```");

            var next = await NextMessageAsync();

            if (next.Content == "1")
            {
                await ReplyAsync(
                    "Please reply with the welcome message you want to be sent when a user joins the server ie. `Welcome to Our Server!!`");

                var next2 = await NextMessageAsync();

                GuildConfig.SetWMessage(Context.Guild, next2.Content);
                GuildConfig.SetWChannel(Context.Guild, Context.Channel.Id);
                await ReplyAsync("The Welcome Message for this server has been set to:\n" +
                                 $"**{next2.Content}**\n" +
                                 $"In the channel **{Context.Channel.Name}**");
            }
            else if (next.Content == "2")
            {
                GuildConfig.SetWChannel(Context.Guild, Context.Channel.Id);
                await ReplyAsync($"Welcome Events will be sent in the channel: **{Context.Channel.Name}**");
            }
            else if (next.Content == "3")
            {
                GuildConfig.SetWelcomeStatus(Context.Guild, true);
                await ReplyAsync("Welcome Messageing for this server has been set to: true");
            }
            else if (next.Content == "4")
            {
                GuildConfig.SetWelcomeStatus(Context.Guild, false);
                await ReplyAsync("Welcome Messageing for this server has been set to: false");
            }
            else if (next.Content == "5")
            {
                var l     = GuildConfig.Load(Context.Guild.Id);
                var embed = new EmbedBuilder();
                try
                {
                    embed.AddField("Message", l.WelcomeMessage);
                    embed.AddField("Channel", Context.Guild.GetChannel(l.WelcomeChannel).Name);
                    embed.AddField("Status", l.WelcomeEvent ? "On" : "Off");
                    await ReplyAsync("", false, embed.Build());
                }
                catch
                {
                    await ReplyAsync(
                        "Error, this guilds welcome config is not fully set up yet, please consider using options 1 thru 4 first");
                }
            }
            else
            {
                await ReplyAsync("ERROR: you did not supply an option. type only `1` etc.");
            }
        }