public static Embed CreateReactionRoleEmbedLog(RoleUpdateEvent update, ReactionRoleConfig config)
 {
     return(new EmbedBuilder()
            .WithAuthor(update.User)
            .WithTitle($"Reaction Role: {config.Name}")
            .WithDescription($"User: {MentionUtils.MentionUser(update.User.Id)}({update.User.Nickname})")
            .AddField("Roles Added", update.RolesChanged.ToAdd.GetRoleMentions())
            .AddField("Roles Removed", update.RolesChanged.ToRemove.GetRoleMentions())
            .WithCurrentTimestamp()
            .WithColor(116, 223, 207)
            .Build());
 }
Beispiel #2
0
        //TODO Add a cancel scheduled unjail function

        private async Task SetJailDetails(RoleUpdateEvent updateEvent, ulong logChannel)
        {
            await SendUserMessage(
                $"> **Jail record for User:{updateEvent.User.Mention} on Server: {Context.Guild.Name}**");

            var result =
                from reason in GetJailReason()
                from duration in GetJailDuration()
                from _ in SendJailLog(reason, duration, updateEvent, logChannel)
                select duration;
            var durationResult = await result;

            if (durationResult.IsFailure())
            {
                return;
            }
            var dura = durationResult.Get();
            await _unjail.ScheduleUnjail(dura, updateEvent, logChannel);

            await TrySendLogMessage(logChannel,
                                    $"> User {MentionUtils.MentionUser(updateEvent.User.Id)} will be unjailed automatically in {dura}.");
        }
Beispiel #3
0
 public static Embed CreateJailLogEmbed(string reason, JailTimeSpan duration, IUser caller, RoleUpdateEvent target)
 {
     return(new EmbedBuilder()
            .WithAuthor(caller)
            .WithTitle("Jailing Log")
            .AddField("Target", MentionUtils.MentionUser(target.User.Id))
            .AddField("Duration", duration.ToString())
            .AddField("Reason", reason)
            .AddField("Roles Taken", target.RolesChanged.ToRemove.GetRoleMentions())
            .AddField("Roles Added", target.RolesChanged.ToAdd.GetRoleMentions())
            .WithColor(116, 223, 207)
            .WithCurrentTimestamp()
            .Build());
 }
        private async Task <Result <Unit> > SendJailLog(string reason, JailTimeSpan duration, RoleUpdateEvent target, ulong channel)
        {
            var embed = CreateJailLogEmbed(reason, duration, Context.User, target);

            await TrySendLogMessage(logChannel : channel, embed : embed);

            return(new Unit());
        }