qeled / discordie

Predictable JavaScript abstractions for Discord API.
https://qeled.github.io/discordie/
BSD 2-Clause "Simplified" License
190 stars 45 forks source link

Broken emoji sometimes #54

Closed brawaru closed 7 years ago

brawaru commented 7 years ago

Two of my bots use discordie library. And I noticed, that sometimes after sending, emoji completely broken in message.

One bot adds :DiscordIcon: emote to twitch chat messages: image

Second bot failed at eval*: image

.r_eval ``let emoteList = $.Guild.emojis.map(em => "<:"+em.name+":"+em.id+"> - "+em.name);
let emToSend = [];
emoteList.forEach((emote,index)=> {
   emToSend.push(emote);
   if(emToSend.length === 10 || index === (emoteList.length - 1)) {
       $.Reply(emToSend.join("\n"));
       emToSend = [];
   }
});
``

by adding some code we can check, that emoji really broken: image

* - any emotes starting with dwillis can be used only by subscribers, so bot can't use them, it's OK

UPD: Some guy on Discord.API server told me, that emotes also have ratelimit:

image

So may be add some handler for this? 🤕

Thanks!

MinnDevelopment commented 7 years ago

That was meant for reactions not emotes.

MinnDevelopment commented 7 years ago

If you use an emoji formatted like <:name:id> with a valid id that you are unable to, use all emojis using that format will automatically be converted to :name: and display as such. So make sure you have access to all the emojis you use in the messages.

Consider:

brawaru commented 7 years ago

Oh, sorry. We didn't understand each other.

These emotes available to bot: image

But final result: image

When next message (which was sent after ~4 seconds from this broken message) is absolutely fine

UPD: I even checked :FSSuspect: emote: image

UPD2: Found why. When message contains other emotes, which can't be used by bot, Discord (?) don't shows other emotes. May be Discord related problem, but still not sure.

MinnDevelopment commented 7 years ago

I broke it down in my comment before, if the bot is unable to use one of the emojis in the message all emojis in that message will be converted to :name: and not display as emoji.

brawaru commented 7 years ago

Not cool. So it's Discord's thing? image

MinnDevelopment commented 7 years ago

Yes, "it's Discord's thing"

brawaru commented 7 years ago

So sad. But OK. Thanks you.