# Problems with Twitch IRC Bot

**URL:** <https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823>\
**Category:** Chat and IRC\
**Created:** [July 17, 2015, 12:13pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823 "2015-07-17T12:13:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![realnachoman](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@realnachoman](https://staging-discuss.dev.twitch.com/u/realnachoman)\
**Post date:** [July 17, 2015, 12:13pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/1 "2015-07-17T12:13:24Z")

</div>

Hey you guys,

I recently started programming a Twitch Chat Bot for myself.  
I’m using the mIRC scripting language, but i’m running into an error i can’t figure out.  
In my program i’m using

```
> on *:text:!hi:#:{
> if ($nick isop #) { msg # Hi there! }
> else { msg # Sorry, $nick you cannot use this command }
> }

```

but when i’m running the command i’m always the getting the message in the else block.  
I tried it with my bot, who is currently a mod in my channel and with my broadcaster nick.

Every other command is functioning, it’s just that mod/ op thing that’s messed up for me.  
Does anyone of you can help me figure out why?

Thanks,  
realnachoman

---

<div class="post-metadata">

**Author:** ![3ventic](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://staging-discuss.dev.twitch.com/u/3ventic)\
**Post date:** [July 18, 2015, 5:15am UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/2 "2015-07-18T05:15:56Z")

</div>

Relying on OP status is a poor way of doing it nowadays. The preferred way is to check the [message tags](https://github.com/justintv/Twitch-API/blob/master/IRC.md#tags). If you still want to rely on OP status, you need to request the [membership capability](https://github.com/justintv/Twitch-API/blob/master/IRC.md#membership) when connecting to the server.

---

<div class="post-metadata">

**Author:** ![realnachoman](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@realnachoman](https://staging-discuss.dev.twitch.com/u/realnachoman)\
**Post date:** [July 18, 2015, 2:39pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/3 "2015-07-18T14:39:38Z")

</div>

Thanks for your answer!

Is there any tutorial on how to use CAP REQ :twitch.tv/tags ?  
Can’t figure out how i bind them in my programm and i can’t find anything useful on google.

---

<div class="post-metadata">

**Author:** ![icebice](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/icebice/32/624_2.png) [@icebice](https://staging-discuss.dev.twitch.com/u/icebice)\
**Post date:** [July 24, 2015, 7:54am UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/4 "2015-07-24T07:54:15Z")

</div>

You can use the /raw command to send raw data to the server. You can either put this into perform or send them on \*:connect. I think you only need one of these though but I suggest using both for most data.

/raw CAP REQ :twitch.tv/commands  
/raw CAP REQ :twitch.tv/membership

Edit: add /tags too. Pretty neat info on users when they send something as second poster already said :).

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 24, 2015, 5:03pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/5 "2015-07-24T17:03:18Z")

</div>

Basically it’s advisable to send your CAP requests after (the first line of) MOTD and before JOIN

---

<div class="post-metadata">

**Author:** ![3ventic](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://staging-discuss.dev.twitch.com/u/3ventic)\
**Post date:** [July 24, 2015, 8:50pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/6 "2015-07-24T20:50:02Z")

</div>

Sending the CAP requests before PASS as the very first thing is how the web chat does it, which also guarantees you get GLOBALUSERSTATE as soon as you login, after MOTD.

You can also bundle the CAP requests in one command `CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership` (only use the ones you need, of course)

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [August 23, 2015, 8:50pm UTC](https://staging-discuss.dev.twitch.com/t/problems-with-twitch-irc-bot/2823/7 "2015-08-23T20:50:08Z")

</div>

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