Exemple #1
0
            public async Task RemoveStoreItem([Remainder] string ItemName)
            {
                var guildobj = GuildConfig.GetServer(Context.Guild);

                var selecteditem = guildobj.Gambling.Store.ShowItems.FirstOrDefault(x =>
                                                                                    string.Equals(x.ItemName, ItemName, StringComparison.CurrentCultureIgnoreCase));

                if (selecteditem == null)
                {
                    await ReplyAsync("There are no items in the store with that name.");

                    return;
                }

                if (selecteditem.ItemID < 0)
                {
                    await ReplyAsync("You cannot remove the default items");

                    return;
                }

                selecteditem.Hidden = true;
                GuildConfig.SaveServer(guildobj);
                await ReplyAsync($"{ItemName} has been removed from the store");
            }
Exemple #2
0
        public async Task Prefix([Remainder] string newpre = null)
        {
            if (newpre == null)
            {
                await ReplyAsync("Please supply a prefix to use.");

                return;
            }

            if (newpre.StartsWith("(") && newpre.EndsWith(")"))
            {
                newpre = newpre.TrimStart('(');
                newpre = newpre.TrimEnd(')');
            }

            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.Prefix = newpre;

            GuildConfig.SaveServer(jsonObj, Context.Guild);

            await ReplyAsync($"the prefix has been updated to `{newpre}`\n" +
                             $"NOTE: the Default prefix `{Load.Pre}` and @mentions will still work\n" +
                             $"NOTE: if you want to have any spaces in the prefix enclose your new prefix in brackets, ie.\n" +
                             $"`(newprefix)`");
        }
Exemple #3
0
        public async Task Tagdel(string tagname)
        {
            var ServerConfig = GuildConfig.GetServer(Context.Guild);

            if (ServerConfig.Dict.Count > 0)
            {
                foreach (var tagging in ServerConfig.Dict)
                {
                    if (string.Equals(tagging.Tagname, tagname, StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (((SocketGuildUser)Context.User).GuildPermissions.Administrator)
                        {
                            ServerConfig.Dict.Remove(tagging);
                            await ReplyAsync("Tag Deleted using Admin Permissions");
                        }
                        else if (tagging.Creator == Context.User.Id)
                        {
                            ServerConfig.Dict.Remove(tagging);
                            await ReplyAsync("Tag Deleted By Owner");
                        }
                        else
                        {
                            await ReplyAsync("You do not own this tag");
                        }

                        GuildConfig.SaveServer(ServerConfig);
                        return;
                    }
                }

                return;
            }

            await ReplyAsync($"No Tags found with the name: {tagname}");
        }
Exemple #4
0
        public async Task AddLevel(IRole role, int level)
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            if (GuildObj.Levels.LevelRoles.Any(x => x.RoleID == role.Id))
            {
                await ReplyAsync($"This role is already a level you may remove it using the removelevel command!");

                return;
            }

            if (level <= 0)
            {
                await ReplyAsync($"Levels must be greater than zero");

                return;
            }

            GuildObj.Levels.LevelRoles.Add(new GuildConfig.levelling.Level
            {
                RoleID       = role.Id,
                LevelToEnter = level
            });

            await ReplyAsync($"New Level Added: {role.Name}\n" +
                             $"Level Requirement: {level}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #5
0
        public async Task PUserCount()
        {
            var guild = GuildConfig.GetServer(Context.Guild);

            guild.PartnerSetup.showusercount = !guild.PartnerSetup.showusercount;
            await ReplyAsync($"Will show UserCount in pertner messages: {guild.PartnerSetup.showusercount}");

            var home = Homeserver.Load().PartnerUpdates;
            var chan = await Context.Client.GetChannelAsync(home);

            if (chan is IMessageChannel channel)
            {
                var embed2 = new EmbedBuilder
                {
                    Title       = "Partner UserCount Toggled",
                    Description = $"{Context.Guild.Name}\n" +
                                  $"`{Context.Guild.Id}`\n" +
                                  $"Channel: {Context.Channel.Name}\n" +
                                  $"ShowUserCount: {guild.PartnerSetup.showusercount}"
                };
                await channel.SendMessageAsync("", false, embed2.Build());
            }

            GuildConfig.SaveServer(guild);
        }
Exemple #6
0
            public async Task AddStoreItem(int ItmCost, int ItmQuantity, [Remainder] string ItemName)
            {
                var guildobj = GuildConfig.GetServer(Context.Guild);
                var newitem  = new GuildConfig.gambling.TheStore.Storeitem
                {
                    ItemName         = ItemName,
                    cost             = ItmCost,
                    quantity         = ItmQuantity,
                    InitialCreatorID = Context.User.Id,
                    ItemID           = guildobj.Gambling.Store.ShowItems.Count
                };
                var embed = new EmbedBuilder();

                embed.Title       = ItemName + " Added";
                embed.Description = $"`1` Attack: {newitem.Attack}\n" +
                                    $"`2` Defense: {newitem.Defense}\n" +
                                    $"`3` Cost: {newitem.cost}\n" +
                                    $"`4` Quantity: {newitem.quantity}\n" +
                                    $"`5` Total Purchased: {newitem.total_purchased}\n" +
                                    $"`6` Name: {newitem.ItemName}\n";
                await ReplyAsync("", false, embed.Build());

                guildobj.Gambling.Store.ShowItems.Add(newitem);
                GuildConfig.SaveServer(guildobj);
            }
Exemple #7
0
        public async Task Toggle()
        {
            var guild = GuildConfig.GetServer(Context.Guild);

            guild.RoleConfigurations.ColorRoleList.AllowCustomColorRoles = !guild.RoleConfigurations.ColorRoleList.AllowCustomColorRoles;
            GuildConfig.SaveServer(guild);
            await ReplyAsync($"Color Roles Enabled: {guild.RoleConfigurations.ColorRoleList.AllowCustomColorRoles}");
        }
Exemple #8
0
        public async Task ApiAIToggle()
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.chatwithmention = !jsonObj.chatwithmention;
            GuildConfig.SaveServer(jsonObj);
            await ReplyAsync(
                $"Using {Context.Client.CurrentUser.Mention} at the start of a message will allow the use or random chat messages is set to: {jsonObj.chatwithmention}");
        }
Exemple #9
0
        public async Task SetLevelChannel()
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            GuildObj.Levels.LevellingChannel = Context.Channel.Id;
            await ReplyAsync($"Level Up Notifications will now be sent to: {Context.Channel.Name}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #10
0
        public async Task ToggleLevelUp()
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            GuildObj.Levels.UseLevelMessages = !GuildObj.Levels.UseLevelMessages;
            await ReplyAsync($"Level Up Notifications are now set to: {GuildObj.Levels.UseLevelMessages}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #11
0
        public async Task ToggleSystem()
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            GuildObj.Levels.LevellingEnabled = !GuildObj.Levels.LevellingEnabled;
            await ReplyAsync($"Levelling System is now set to: {GuildObj.Levels.LevellingEnabled}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #12
0
        public async Task ToggleLevelIncrement()
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            GuildObj.Levels.IncrementLevelRewards = !GuildObj.Levels.IncrementLevelRewards;
            await ReplyAsync(
                $"Users will only have one level reward at a time: {GuildObj.Levels.IncrementLevelRewards}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #13
0
        public async Task ToggleLevelChannel()
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            GuildObj.Levels.UseLevelChannel = !GuildObj.Levels.UseLevelChannel;
            await ReplyAsync(
                $"Sending Level Up notifications to a specific channel is now set to: {GuildObj.Levels.UseLevelChannel}");

            GuildConfig.SaveServer(GuildObj);
        }
Exemple #14
0
        public async Task Clear()
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.Blacklist = new List <string>();

            GuildConfig.SaveServer(jsonObj, Context.Guild);

            await ReplyAsync("The blacklist has been cleared.");
        }
Exemple #15
0
        public async Task SetMod(IRole modRole)
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.ModeratorRoleId = modRole.Id;

            GuildConfig.SaveServer(jsonObj, Context.Guild);

            await ReplyAsync($"ModRole has been set as {modRole.Mention}");
        }
Exemple #16
0
        public async Task SetModLogChannel()
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.ModLogChannel = Context.Channel.Id;

            GuildConfig.SaveServer(jsonObj);

            await ReplyAsync($"Mod Log will now be sent in:\n" +
                             $"{Context.Channel.Name}");
        }
Exemple #17
0
        public async Task ToggleModLog()
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.LogModCommands = !jsonObj.LogModCommands;

            GuildConfig.SaveServer(jsonObj);

            await ReplyAsync($"Log Mod Commands: {jsonObj.LogModCommands}\n" +
                             $"Use the SetModLogChannel Command so set the channel where these will be sent!");
        }
Exemple #18
0
        public async Task BlMessage([Remainder] string blmess = null)
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.BlacklistMessage = blmess ?? "";


            GuildConfig.SaveServer(jsonObj, Context.Guild);

            await ReplyAsync("The blacklist has been cleared.");
        }
Exemple #19
0
        public async Task Tag(string tagname = null)
        {
            if (tagname == null)
            {
                var tags = GuildConfig.GetServer(Context.Guild).Dict;
                if (tags.Count > 0)
                {
                    var taglist = string.Join(", ", tags.Select(x => x.Tagname));
                    await ReplyAsync($"**Tags:** {taglist}");
                }
                else
                {
                    await ReplyAsync("This server has no tags yet.");
                }
            }
            else
            {
                var server = GuildConfig.GetServer(Context.Guild);
                var embed  = new EmbedBuilder();
                if (server.Dict.Count > 0)
                {
                    var tag = server.Dict.FirstOrDefault(x =>
                                                         string.Equals(x.Tagname, tagname, StringComparison.CurrentCultureIgnoreCase));
                    if (tag == null)
                    {
                        await ReplyAsync($"No tag with the name **{tagname}** exists.");
                    }
                    else
                    {
                        string ownername;
                        try
                        {
                            var own = await Context.Guild.GetUserAsync(tag.Creator);

                            ownername = own.Username;
                        }
                        catch
                        {
                            ownername = "Owner Left";
                        }

                        embed.AddField(tag.Tagname, tag.Content);
                        embed.WithFooter(x =>
                        {
                            x.Text =
                                $"Tag Owner: {ownername} || Uses: {tag.uses} || Command Invokee: {Context.User.Username}";
                        });
                        tag.uses++;
                        GuildConfig.SaveServer(server);
                        await ReplyAsync("", false, embed.Build());
                    }
                }
            }
        }
Exemple #20
0
            public async Task InitStore()
            {
                var guildobj = GuildConfig.GetServer(Context.Guild);
                var sitems   = new List <GuildConfig.gambling.TheStore.Storeitem>
                {
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":wrench:",
                        ItemID   = -15,
                        Hidden   = true,
                        cost     = 15
                    },
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":evergreen_tree:",
                        ItemID   = -10,
                        Hidden   = true,
                        cost     = 10
                    },
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":full_moon:",
                        ItemID   = -5,
                        Hidden   = true,
                        cost     = 12
                    },
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":zap:",
                        ItemID   = -16,
                        Hidden   = true,
                        cost     = 50
                    },
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":apple:",
                        ItemID   = -11,
                        Hidden   = true,
                        cost     = 25
                    },
                    new GuildConfig.gambling.TheStore.Storeitem
                    {
                        ItemName = ":gem:",
                        ItemID   = -6,
                        Hidden   = true,
                        cost     = 100
                    }
                };

                guildobj.Gambling.Store.ShowItems.AddRange(sitems);
                GuildConfig.SaveServer(guildobj);
                await ReplyAsync("Added");
            }
Exemple #21
0
        public async Task SetMod(IRole modRole)
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            if (!jsonObj.RoleConfigurations.ModeratorRoleList.Contains(modRole.Id))
            {
                jsonObj.RoleConfigurations.ModeratorRoleList.Add(modRole.Id);
            }

            GuildConfig.SaveServer(jsonObj);

            await ReplyAsync($"{modRole.Mention} has been added to the moderator roles");
        }
Exemple #22
0
        public async Task SellItem(int quantity, [Remainder] string name = null)
        {
            await Setupuser(Context.Guild, Context.User);

            var guildobj = GuildConfig.GetServer(Context.Guild);

            var selecteditem = guildobj.Gambling.Store.ShowItems.FirstOrDefault(x =>
                                                                                string.Equals(name, x.ItemName, StringComparison.InvariantCultureIgnoreCase));
            var uprofile = guildobj.Gambling.Users.FirstOrDefault(x => x.userID == Context.User.Id);

            if (selecteditem == null)
            {
                await ReplyAsync($"{name} is not an item i the store.");

                return;
            }

            var invitem = uprofile.Inventory.Where(x => x.Durability == 100)
                          .FirstOrDefault(x => x.ItemID == selecteditem.ItemID);

            if (invitem == null)
            {
                await ReplyAsync(
                    $"You do not own this item (or you have already used it and it's durability has decreased.)");

                return;
            }

            if (invitem.quantity < quantity)
            {
                await ReplyAsync($"You cannot sell this many of that item");

                return;
            }

            if (invitem.quantity - quantity == 0)
            {
                uprofile.Inventory.Remove(invitem);
            }
            else
            {
                invitem.quantity = invitem.quantity - quantity;
            }

            uprofile.coins = uprofile.coins + selecteditem.cost * quantity;
            if (selecteditem.quantity != -1)
            {
                selecteditem.quantity = selecteditem.quantity + quantity;
            }
            GuildConfig.SaveServer(guildobj);
        }
Exemple #23
0
        public async Task ResetKick()
        {
            var file = Path.Combine(AppContext.BaseDirectory, $"setup/server/{Context.Guild.Id}.json");

            if (!File.Exists(file))
            {
                GuildConfig.Setup(Context.Guild);
            }
            var config = GuildConfig.GetServer(Context.Guild);

            config.Kicking = new List <GuildConfig.Kicks>();
            GuildConfig.SaveServer(config, Context.Guild);
            await ReplyAsync($"All server kicks have been cleared.");
        }
Exemple #24
0
 public async Task UnHideCommand([Remainder] string cmdname = null)
 {
     if (_service.Commands.Any(x => string.Equals(x.Name, cmdname, StringComparison.CurrentCultureIgnoreCase)))
     {
         var jsonObj = GuildConfig.GetServer(Context.Guild);
         jsonObj.Visibilityconfig.BlacklistedCommands.Remove(cmdname.ToLower());
         GuildConfig.SaveServer(jsonObj);
         await ReplyAsync($"{cmdname} is now accessible to non-admins again");
     }
     else
     {
         await ReplyAsync($"No command found with this name.");
     }
 }
Exemple #25
0
        public async Task CreateGiveaway([Remainder] string description)
        {
            var server = GuildConfig.GetServer(Context.Guild);

            var comp = new GuildConfig().Comp;

            comp.Message = description;
            comp.Users   = new List <ulong>();
            comp.Creator = Context.User.Id;
            server.Comp  = comp;

            GuildConfig.SaveServer(server);

            await ReplyAsync("GiveAway Created.");
        }
Exemple #26
0
 public async Task HideModule([Remainder] string modulename = null)
 {
     if (_service.Modules.Any(x => string.Equals(x.Name, modulename, StringComparison.CurrentCultureIgnoreCase)))
     {
         var jsonObj = GuildConfig.GetServer(Context.Guild);
         jsonObj.Visibilityconfig.BlacklistedModules.Add(modulename.ToLower());
         GuildConfig.SaveServer(jsonObj);
         await ReplyAsync(
             $"Commands from {modulename} will no longer be accessible or visible to regular users");
     }
     else
     {
         await ReplyAsync($"No module found with this name.");
     }
 }
Exemple #27
0
        public async Task NoMention(bool status)
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.MentionAll = status;
            GuildConfig.SaveServer(jsonObj, Context.Guild);

            if (status)
            {
                await ReplyAsync("Mass Mentions will now be deleted!");
            }
            else
            {
                await ReplyAsync("Mass Mentions are now allowed to be sent");
            }
        }
Exemple #28
0
        public async Task NoInvite(bool status)
        {
            var jsonObj = GuildConfig.GetServer(Context.Guild);

            jsonObj.Invite = status;
            GuildConfig.SaveServer(jsonObj, Context.Guild);

            if (status)
            {
                await ReplyAsync("Invite links will now be deleted!");
            }
            else
            {
                await ReplyAsync("Invite links are now allowed to be sent");
            }
        }
Exemple #29
0
        public async Task Removelevel(IRole role)
        {
            var GuildObj = GuildConfig.GetServer(Context.Guild);

            if (GuildObj.Levels.LevelRoles.Any(x => x.RoleID == role.Id))
            {
                GuildObj.Levels.LevelRoles.Remove(GuildObj.Levels.LevelRoles.FirstOrDefault(x => x.RoleID == role.Id));
                await ReplyAsync($"Success Level Role has been removed.");

                GuildConfig.SaveServer(GuildObj);
            }
            else
            {
                await ReplyAsync($"ERROR: This role is not a level!");
            }
        }
        public async Task WarnUser(SocketGuildUser user, [Remainder] string reason = null)
        {
            var file = Path.Combine(AppContext.BaseDirectory, $"setup/server/{Context.Guild.Id}.json");

            if (!File.Exists(file))
            {
                GuildConfig.Setup(Context.Guild);
            }
            var embed = new EmbedBuilder();

            if (reason == null)
            {
                embed.AddField("Error", "Please Specify a reason for warning the user, ie\n" +
                               "`.warn @noobnoob being a noob");
                await ReplyAsync("", false, embed.Build());

                return;
            }
            var config = GuildConfig.GetServer(Context.Guild);

            var add = new GuildConfig.Warns
            {
                Moderator = Context.User.Username,
                Reason    = reason,
                User      = user.Username,
                UserId    = user.Id
            };

            try
            {
                await user.SendMessageAsync($"You have been warned in {Context.Guild.Name} for:\n" +
                                            $"`{reason}`");
            }
            catch
            {
                //
            }

            config.Warnings.Add(add);
            GuildConfig.SaveServer(config, Context.Guild);

            embed.AddField("User Warned", $"User: {user.Username}\n" +
                           $"UserID: {user.Id}\n" +
                           $"Moderator: {Context.User.Username}\n" +
                           $"Reason: {reason}");
            await ReplyAsync("", false, embed.Build());
        }