Esempio n. 1
0
        private async Task Prefix(string prefix)
        {
            var    guild     = ServerStorage.GetGuild(Context.Guild);
            string oldprefix = guild.prefix;

            guild.prefix = prefix;
            await ReplyAsync("Your prefix has been changed from " + oldprefix + " to " + prefix);

            ServerStorage.SaveGuilds();
        }
Esempio n. 2
0
        private async Task infot()
        {
            // Add a mod log to the guild collected from guildstorage and create the channel
            var guild = ServerStorage.GetGuild(Context.Guild);

            await ReplyAsync("Adding a moderation log to this guild...");

            IGuildChannel chnl = await Context.Guild.CreateTextChannelAsync("mod-log");

            guild.Modlog   = true;
            guild.Modlogid = chnl.Id;
            ServerStorage.SaveGuilds();
            await ReplyAsync("Your guild now has a moderation log. To remove this log type -removemodlog");
        }
Esempio n. 3
0
        private async Task RemoveModLog()
        {
            // Remove the modlog from the guild collected from guildstorage and remove the channel
            var guild = ServerStorage.GetGuild(Context.Guild);
            var chnl  = Context.Guild.GetChannel(guild.Modlogid);

            await ReplyAsync("Now removing modlog from your guild...");

            await chnl.DeleteAsync();

            guild.Modlogid = 0;
            guild.Modlog   = false;
            ServerStorage.SaveGuilds();
            await ReplyAsync("Your guild no longer has a moderation log");
        }
Esempio n. 4
0
        private async Task Kick(IGuildUser user = null, [Remainder] string reason = "reason not set")
        {
            // If an invalid user is chosen, notify the user
            if (user == null)
            {
                await ReplyAsync("Invalid User");
            }
            else
            {
                // Delete the context message and send the kicked message
                await Context.Message.DeleteAsync();
                await ReplyAsync("Kicked " + user.Username + " for " + reason);

                // Get the guild and save all guilds
                var guild = ServerStorage.GetGuild(Context.Guild);
                ServerStorage.SaveGuilds();

                if (guild.Modlog)
                {
                    // Create a modlog embed and send it to the modlog
                    var eb = new EmbedBuilder();
                    eb.WithColor(Color.Teal);
                    eb.WithCurrentTimestamp();
                    eb.WithTitle("A user has been kicked!");
                    if (user.IsBot)
                    {
                        eb.WithTitle("A bot has been kicked!");
                        eb.AddField("Bot", user.Username, true);
                    }
                    else
                    {
                        eb.WithTitle("A user has been kicked!");
                        eb.AddField("User", user.Username, true);
                    }
                    eb.AddField("Moderator", Context.Message.Author.Username, true);
                    eb.AddField("Reason", reason, true);
                    eb.WithThumbnailUrl(user.GetAvatarUrl());
                    SocketTextChannel ml = (SocketTextChannel)Context.Guild.GetChannel(guild.Modlogid);
                    var ebb = eb.Build();
                    await ml.SendMessageAsync("", false, ebb);
                }
                await user.KickAsync(reason);
            }
        }