Esempio n. 1
0
 public ButtonBuilder WithEmoji(Snowflake id)
 {
     _buttonComponent = _buttonComponent with {
         Emoji = new PartialEmoji(id)
     };
     return(this);
 }
Esempio n. 2
0
 public ButtonBuilder WithEmoji(string unicode)
 {
     _buttonComponent = _buttonComponent with {
         Emoji = new PartialEmoji(Name: unicode)
     };
     return(this);
 }
Esempio n. 3
0
        public async Task AddEmoji(PartialEmoji e, DiscordClient source, MouseButtonEventHandler onClick, MouseEventHandler onMove)
        {
            var img = new Image()
            {
                Width   = 48,
                Height  = 48,
                ToolTip = ':' + e.name + ':',
                Tag     = source.FromCache(e)
            };

            this.Emojis.Add(img);
            var data = await source.EmojiFromCache(e);

            if (data == null)
            {
                return;
            }
            if (e.animated)
            {
                ImageBehavior.SetAnimatedSource(img, data);
            }
            else
            {
                img.Source = data;
            }
            img.MouseDown += onClick;
            img.MouseMove += onMove;
        }
Esempio n. 4
0
        private async void AddExtraEmoji(object sender, ExecutedRoutedEventArgs e)
        {
            var id = Clipboard.GetText();

            if (!DiscordClient.IDValid(id))
            {
                StatusLabel.Content = "Invalid emoji ID";
                return;
            }

            var x = MessageBox.Show("Is this emoji animated?", "New emoji", MessageBoxButton.YesNo);

            if (x == MessageBoxResult.Cancel)
            {
                return;
            }
            StatusLabel.Content = "Loading emoji...";
            var p = new PartialEmoji(id, "extra" + id, x == MessageBoxResult.Yes);

            GuildDisplay Extra;

            if (!ExtraExists())
            {
                Extra = new GuildDisplay(new PartialGuild("0", "Extra"));
                Servers.Insert(0, Extra);
            }
            else
            {
                Extra = Servers[0];
            }
            Extra.IsExpanded = true;

            await Extra.AddEmoji(p, C, EmojiClicked, EmojiDragged);

            if (p.animated)
            {
                await BulkResizer.ResizeGif(C.FromCache(p));
            }
            else
            {
                await BulkResizer.ResizePng(C.FromCache(p));
            }
            StatusLabel.Content = "Emoji added";
        }
Esempio n. 5
0
 public ComponentFormButton(MessageButtonStyle style, PartialEmoji emoji)
 {
     Style = style;
     Emoji = emoji;
 }