# Issues with reading messages in channel

**URL:** <https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467>\
**Category:** Chat and IRC\
**Created:** [December 18, 2021, 1:23pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467 "2021-12-18T13:23:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![weirdbeardgames](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/weirdbeardgames/32/12444_2.png) [@weirdbeardgames](https://discuss.dev.twitch.com/u/weirdbeardgames)\
**Post date:** [December 18, 2021, 1:23pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/1 "2021-12-18T13:23:10Z")

</div>

So, I’m writing a chat bot in c++ that at ONE POINT was working correctly. The bot in it’s current stat will join my channel and appears in the user list. Can see member join events and prints them out. Can even get whispers. [ChatPlays/twitch.cpp at main · kenshen112/ChatPlays · GitHub](https://github.com/kenshen112/ChatPlays/blob/main/src/twitch.cpp#L100)

I cannot for the life of me figure out why I was able to have it join my channel previously and it was able to read messages from chat but it cannot now. I have tried joining with the bots username and oauth token. I have also tried joining it as myself with an oauth key generated with that account.

I’m joining with a channel name in all lowercase, the bots name is all lowercase so neither of those are the issue and as I’d previously mentioned it appears in the user list. Can anyone help me?

---

<div class="post-metadata">

**Author:** ![Freddy](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/freddy/32/111_2.png) [@Freddy](https://discuss.dev.twitch.com/u/Freddy)\
**Post date:** [December 18, 2021, 1:38pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/2 "2021-12-18T13:38:52Z")

</div>

My first guess is that you forget to add `oauth:` in front of your OAuth token in like [#84](https://github.com/kenshen112/ChatPlays/blob/main/src/twitch.cpp#L84)

> std::string buf1 = ("PASS " + settings.oauthToken + “\r\n”);

If that’s not the problem, try logging all raw lines you get from the server and look for error messages.

---

<div class="post-metadata">

**Author:** ![weirdbeardgames](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/weirdbeardgames/32/12444_2.png) [@weirdbeardgames](https://discuss.dev.twitch.com/u/weirdbeardgames)\
**Post date:** [December 18, 2021, 2:14pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/3 "2021-12-18T14:14:57Z")

</div>

It’s in the settings file itself I have the oauth: and to my understanding the bot wouldn’t join if the oauth was wrong would it?

And I mean that as a genuine question

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [December 18, 2021, 2:29pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/4 "2021-12-18T14:29:30Z")

</div>

Log all response messages the server sends you to check for USERNOTICE or NOTICE messages.

---

<div class="post-metadata">

**Author:** ![weirdbeardgames](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/weirdbeardgames/32/12444_2.png) [@weirdbeardgames](https://discuss.dev.twitch.com/u/weirdbeardgames)\
**Post date:** [December 18, 2021, 8:25pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/5 "2021-12-18T20:25:11Z")

</div>

[hatebin](https://hatebin.com/oemqhejawg) So, I printed as much of the log as possible. There’s no visual feedback I can see error wise

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [December 19, 2021, 12:37pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/6 "2021-12-19T12:37:49Z")

</div>

Seems for whatever reason after joining a room correctly (`weirdbeardgame`), with no errors, your script is no longer listening for incoming messages from the IRC server.

If you leave this running are you getting PING and reply to this with PONG’s?

---

<div class="post-metadata">

**Author:** ![weirdbeardgames](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/weirdbeardgames/32/12444_2.png) [@weirdbeardgames](https://discuss.dev.twitch.com/u/weirdbeardgames)\
**Post date:** [December 19, 2021, 4:35pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/7 "2021-12-19T16:35:43Z")

</div>

Yes I am. So again, It appears in the channel active user list. It get’s pings and replies with pongs. I can whisper dm and those messages will appear. It just won’t get anything from chat. It makes me think this could be an issue with oauth scops but my understanding was that the twitch tmi site would cover that

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [December 19, 2021, 4:37pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/8 "2021-12-19T16:37:39Z")

</div>

> [@weirdbeardgames](#):
>
> but my understanding was that the twitch tmi site would cover that

never rely on someone elses generator, using someone else clientID

> [@weirdbeardgames](#):
>
> It makes me think this could be an issue with oauth scops

If you don’t have `chat:read` then that could be an issue yes.

Check what you tokeh has with the validate endpoint

> **[Authentication](https://dev.twitch.tv/docs/authentication/)**
>
> Authentication

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [January 18, 2022, 4:37pm UTC](https://discuss.dev.twitch.com/t/issues-with-reading-messages-in-channel/35467/9 "2022-01-18T16:37:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
