Esempio n. 1
0
        public async Task RemoveRole(SocketGuildUser user, ulong roleId)
        {
            if (testMode)
            {
                return;
            }

            await user.RemoveRoleAsync(CurGuild.GetRole(roleId));
        }
Esempio n. 2
0
        public SocketGuildUser GetUser(ulong userId)
        {
            if (testMode)
            {
                return(null);
            }

            return(CurGuild.GetUser(userId));
        }
Esempio n. 3
0
        public ISocketMessageChannel GetChannel(ulong id)
        {
            if (testMode)
            {
                return(null);
            }

            // the bot is designed to only be in one server
            return(CurGuild.GetTextChannel(id));
        }
Esempio n. 4
0
        public async Task <RestCategoryChannel> CreateCategory(string name)
        {
            if (testMode)
            {
                return(null);
            }

            var cat = await CurGuild.CreateCategoryChannelAsync(name);

            await cat.AddPermissionOverwriteAsync(CurGuild.EveryoneRole, new OverwritePermissions(0, sendInt));

            await cat.AddPermissionOverwriteAsync(client.CurrentUser, new OverwritePermissions(botInt, 0));

            return(cat);
        }
Esempio n. 5
0
        public async Task RemoveRoles(SocketGuildUser user, IEnumerable <ulong> roleIds)
        {
            if (testMode)
            {
                return;
            }

            var roles = new List <SocketRole>();

            foreach (var id in roleIds)
            {
                roles.Add(CurGuild.GetRole(id));
            }
            await user.RemoveRolesAsync(roles);
        }
Esempio n. 6
0
        public async Task <RestTextChannel> CreateChannel(string name, ulong categoryId = 0, bool everyoneCanSend = false)
        {
            if (testMode)
            {
                return(null);
            }

            var chnl = await CurGuild.CreateTextChannelAsync(name);

            // deny everyone send message perms
            if (!everyoneCanSend)
            {
                await chnl.AddPermissionOverwriteAsync(CurGuild.EveryoneRole, new OverwritePermissions(0, sendInt));
            }
            // give bot perms to send and manage
            await chnl.AddPermissionOverwriteAsync(client.CurrentUser, new OverwritePermissions(botInt, 0));

            if (categoryId != 0)
            {
                await chnl.ModifyAsync(p => p.CategoryId = categoryId);
            }

            return(chnl);
        }