#Discord bot sends notifications about my games but otherwise considers the account not linked

1 messages · Page 1 of 1 (latest)

timid crystal
#

Just as it says in the title, @late flame sends me notifications whenever my game starts but when I try to type any command it shows me a message that my account is not linked. Within the BAR client when I type $discord command I get the notification that my account is already linked.

Can I re-link my account? Or is there maybe some other way to fix this "half-linked" state?

sullen tundra
#

cc @brazen carbon

brazen carbon
#

Your account appears to be linked

brazen carbon
#

Not sure what's going on here exactly, Teiserver - Discord has several issues that I am trying to fix or rework but unfortunately I ran into some problems I wasn't able to resolve so far. It doesn't help that I can't reproduce it, let me know when you are online, I would like to do a quick test to see which commands teiserver picks up if any

timid crystal
brazen carbon
#

@timid crystaldo it now

#

Send a message to discod bot

timid crystal
#

Sent $help to the bot's DM

#

If the message does not start with $, nothing happens

brazen carbon
#

as intended

#

once more please send $help then $whoami

#

ok I see you have done it

timid crystal
#

The response is the same

brazen carbon
#

oh ok progress!

timid crystal
#

In-game the $discord command shows, as expected, that the accounts are already linked

brazen carbon
#

you are in game right, logged in?

#

ah I see

timid crystal
#

Yes, just logged in

#

Sent commands to the Discord bot while logged-in in-game, the result is the same

#

Saw that in-game Coordinator briefly went offline and then quickly came back online about 9 minutes ago

brazen carbon
#

please login again

#

I disconnected you

timid crystal
#

I think the game automatically reconnected, I didn't see any notification about the disconnect. Should I restart the game to login again?

brazen carbon
#

no, that's fine

#

I think it's an issue with caching but I am not sure where the cause is yet

timid crystal
#

The response from the Discord bot remains the same

brazen carbon
#

Try now

#

any difference?

timid crystal
#

No, still the same

brazen carbon
#

thanks

#

hmmm

#

ok try now

#

it worked I see

#

right?

timid crystal
#

Oh, now it worked

brazen carbon
#

nice

timid crystal
#

Thank you very much!

#

By chance, are the commands the Discord bot supports right now the same as the Coordinator bot commands? I was looking for a command to disable notifications about the game I'm participating in starting

brazen carbon
#

It seems that discord_id was cached as a number and was being looked up as a string but I am not sure why this is causing issues for you specifically, for example it works for me and my user has both number and string of discord_id cached, I will have to investigate this further but unfortunatelly I don't have much time these days.

supple edgeBOT
#

Set a reminder in 1 week from now (<t:1733685141:f>)
View reminders with the reminders command

brazen carbon
#

Specifically it supports these:

  • whatwas
  • unit
  • define
  • text
    in **public **channels
    and these:
  • discord
  • whoami
  • help
  • whatwas
  • unit
    in DMs
#

and help doesnt even work in this context 😄

timid crystal
brazen carbon
#

it doesn't use tags but discord id's, you can get them by endabling dev mode in discord right clicking user then copy user id

#

for example yours is 332825652929626112

#

however teiserver bot chat and message commands have not been touched for quite a while, 2-3 years

#

and I don't think they are used that much, I doubt most people are even aware you can link your account to discord so it's not surprising that any bug in this code didn't get caught, especially as it works for some users...

timid crystal
# brazen carbon for example yours is 332825652929626112

Hm, actually I have an idea of what might have happened, if the ID is converted from an integer or a string to an f64 (such as the number type in JavaScript) then it gets rounded down from 332825652929626112 to 332825652929626100. So, for example, if it's stored in the database as an integer and then the bot runs on something like NodeJS and fetches it from the database, then the bot will then have a different ID to look up than the one stored in the database

However, as I see your ID also gets rounded down, but only by 1 — from 268836132576296961 to 268836132576296960, I would expect the bug to reproduce in that case as well

That's an uneducated guess though, but may be worth considering

brazen carbon
#

pretty sure it's only stored as integer and only converted to string so I don't think there would be such rounding errors

timid crystal
#

Well, as I said, it's an uneducated guess based only on the fact that for other users it didn't seem to cause a problem.

Thanks again for the help!

brazen carbon
#

Np

#

I don't think this is a permanent fix, I wouldn't be surprised if it breaks again when the cache gets deleted