Exemplo n.º 1
0
        private async Task OnUserJoinedGuild(SocketGuildUser user)
        {
            AutoRolesGuildDefinition arg = autoRoles.FirstOrDefault(x => x.guildID == user.Guild.Id);

            // Guild doesn't auto assign any roles.
            if (arg == null)
            {
                return;
            }
            // Give the user every role they should have.
            foreach (string role in arg.roles)
            {
                await GiveRole(user, role);
            }
        }
Exemplo n.º 2
0
        public string RemoveRole(SocketGuild guild, SocketRole role)
        {
            AutoRolesGuildDefinition arg = autoRoles.FirstOrDefault(x => x.guildID == guild.Id);

            if (arg == null)
            {
                return("No roles being assigned in this guild.");
            }
            if (arg.roles.Contains(role.Name.ToLower()))
            {
                arg.roles.Remove(role.Name.ToLower());
                return($"Role {role.Name} removed.");
            }
            return($"Role {role.Name} is not in the list.");
        }
Exemplo n.º 3
0
        public string AddRole(SocketGuild guild, SocketRole role)
        {
            AutoRolesGuildDefinition arg = autoRoles.FirstOrDefault(x => x.guildID == guild.Id);

            if (arg == null)
            {
                arg = new AutoRolesGuildDefinition(guild.Id);
                autoRoles.Add(arg);
            }
            if (!arg.roles.Contains(role.Name.ToLower()))
            {
                arg.roles.Add(role.Name.ToLower());
                return($"Role {role.Name} added.");
            }

            return($"{role.Name} is already in the list.");
        }