Esempio n. 1
0
        public ReactionRole ToDiscord(DiscordClient client, DiscordMessage message)
        {
            var guild = message.Channel.Guild;
            var role  = guild.GetRole(RoleId);
            var emoji = EmojiMapper.ToDiscord(client, Emoji);

            return(new ReactionRole(message, emoji, role));
        }
Esempio n. 2
0
        public async ValueTask <DiscordEmoji?> GetEmojiAsync(DiscordClient client, DiscordMessage message, DiscordRole role)
        {
            var rawEmoji = await _context.ReactionRoles
                           .Where(x => x.MessageId == message.Id && x.RoleId == role.Id)
                           .Select(x => x.Emoji)
                           .SingleOrDefaultAsync();

            if (rawEmoji == null)
            {
                return(null);
            }

            return(EmojiMapper.ToDiscord(client, rawEmoji));
        }