예제 #1
0
        public async Task Approve(CommandContext ctx, [Description("Specify the member you want to add")]
                                  string member)
        {
            var memberId = TwitchTasks.ParseMemberToId(member);

            da.UpgradeStream(memberId, ctx.Guild.Id, 0);
            await ctx.RespondAsync($"Ok, I'll now `@here` mention for <@!{memberId}>'s Streams");

            await TwitchTasks.LogAction($"<@!{ctx.Member.Id}> has approved <@!{memberId}>'s Streams for `@here` mentions", ctx.Client);

            if (!TwitchOptions.AutoAssignRoles)
            {
                return;
            }
            var verifiedRoleIdRequest = da.GetSettingsForGuild(ctx.Guild.Id, "VerifiedRole");

            if (verifiedRoleIdRequest.Rows.Count == 0)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(verifiedRoleIdRequest.Rows[0]["biValue"].ToString()))
            {
                return;
            }
            var verifiedRoleId       = ulong.Parse(verifiedRoleIdRequest.Rows[0]["biValue"].ToString() !);
            var verifiedStreamerRole = ctx.Guild.GetRole(verifiedRoleId);
            var discordMember        = await ctx.Guild.GetMemberAsync(memberId);

            await discordMember.GrantRoleAsync(verifiedStreamerRole);
        }