$(chatid) change?

Asked Sep 25, 2020·2 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

We've been using the semi-documented chatid (link expired) variable to determine which live chat on our youtube channel is the the one Nightbot's been called from. We use this to index into a JSON database to which city to use for $(weather).

So doing !weather in the New York chat automatically gives New York weather.

Apparently today, the value returned by $(chatid) changed. It's still unique and could be used to index weather but it's a shortened form of the full Google chatid which can also be used for certain Youtube API calls (and we do use this database to simplify API access).

Is this change intentional and is it permanent?

2 replies

The chat id is actually not something we control. It's what YouTube's APIs tell us the id is. I believe YouTube's on their third iteration of chat internals (from what I heard through the grapevine), so it is possible they changed their identifiers when they moved to this iteration. You may want to store data for a channel id rather than a chat id.

Thanks, that prompted me to look a little further.

While google's video:list API is still returning the "long form" chatId, the other APIs do accept the short form that nightbot is now returning.

This solves my problem.