Exemplo n.º 1
0
        public async Task CreateMentionGroup([Remainder] string roleName)
        {
            if (string.IsNullOrWhiteSpace(roleName))
            {
                await ReplyAsync("Cannot specify a role with an empty name");

                return;
            }

            if (Context.Guild.Roles.Any(x => x.Name.ToLower() == roleName.ToLower()))
            {
                await Context.Channel.SendMessageAsync($"Cannot create another group with the name \"{roleName}\"");

                return;
            }

            var role = await Context.Guild.CreateRoleAsync(roleName);

            await role.ModifyAsync(x =>
            {
                x.Mentionable = true;
            });

            var dbRoleObj = new MentionRole()
            {
                RoleId = role.Id,
                Name   = role.Name
            };

            var db = new AwsDbContext();
            await db.Upsert(dbRoleObj);

            await Context.Channel.SendMessageAsync($"\"{roleName}\" created successfully.");
        }
Exemplo n.º 2
0
        public async Task DeleteMentionGroup([Remainder] IRole role)
        {
            if (!await IsJoinableGroup(role.Id))
            {
                await ReplyAsync($"Cannot delete group \"{role.Name}\" as it is not a custom mention group.");
            }
            else if (Context.Guild.Users.Any(u => !u.IsBot && u.Roles.Select(r => r.Id).Contains(role.Id)))
            {
                await ReplyAsync($"There are currently members part of the group \"{role.Name}\". Only mention groups without members can be deleted.");
            }
            else
            {
                var db        = new AwsDbContext();
                var dbRoleObj = new MentionRole();
                dbRoleObj.RoleId = role.Id;
                await db.Delete(dbRoleObj);

                await role.DeleteAsync();
                await ReplyAsync($"Mention group deleted successfully.");
            }
        }
Exemplo n.º 3
0
 public Task <int> AssignClanMentionRoleAsync(IClan clan, MentionRole mentionRole, bool overrideExistingData = true)
 {
     throw new NotImplementedException();
 }