Exemplo n.º 1
0
    private async Task UpdateRolesForRegisteredUser(SocketGuildUser joiningUser)
    {
        UpdateRolesResponse response = await _updateRolesHelper.UpdateUserRoles(joiningUser);

        if (!response.Success)
        {
            return;
        }

        ulong dailyUpdateChannelId = _config.GetValue <ulong>("DailyUpdateChannelId");

        if (joiningUser.Guild.GetChannel(dailyUpdateChannelId) is SocketTextChannel logsChannel)
        {
            await logsChannel.SendMessageAsync(null, false, EmbedHelper.UpdateRoles(response));
        }
    }
Exemplo n.º 2
0
    public async Task UpdateRolesFromCurrentUser()
    {
        SocketGuildUser user = Context.Guild.GetUser(Context.User.Id);

        (bool isError, string?message) = _userService.IsValid(user, user.Id == Context.User.Id);
        if (isError && message is not null)
        {
            await InlineReplyAsync(message);

            return;
        }

        UpdateRolesResponse response = await _updateRolesHelper.UpdateUserRoles(user);

        if (!response.Success)
        {
            await InlineReplyAsync("No updates were needed.");
        }
        else
        {
            await ReplyAsync(embed : EmbedHelper.UpdateRoles(response), allowedMentions : AllowedMentions.None, messageReference : new(Context.Message.Id));
        }
    }