# !join command for an IRC bot

**URL:** <https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296>\
**Category:** Help / Off-topic\
**Created:** [November 30, 2016, 6:50pm UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296 "2016-11-30T18:50:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wyatt\_Gibbs](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@Wyatt\_Gibbs](https://discuss.dev.twitch.com/u/Wyatt_Gibbs)\
**Post date:** [November 30, 2016, 6:50pm UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296/1 "2016-11-30T18:50:15Z")

</div>

Hey guys I was wanting to to have a bot Idle in its chat and on an !join it sees the $nick for that user and joins there channel automatically if this has been done before just point me in the direction I also was wanting to add an !leave function so that when the Streamer goes offline they or one of the mods can tell the bot to leave so that people that just sit in the chat do not earn the Currency for sitting there. I am using mIRC for coding to integrate it into twitch.

---

<div class="post-metadata">

**Author:** ![matt\_thomas](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/matt_thomas/32/710_2.png) [@matt\_thomas](https://discuss.dev.twitch.com/u/matt_thomas)\
**Post date:** [December 1, 2016, 12:52am UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296/2 "2016-12-01T00:52:45Z")

</div>

> ON \*:TEXT:!join:#: {  
> if (%flood) { return }  
> set -u3 %flood Stop  
> join $chr(35) $+ $nick  
> msg # ACTION joined $nick $+ 's chat   
> }  
> ON \*:TEXT:!leave:#: {  
> if (%flood) { return }  
> if ($msgtags(mod).key == 1) {  
> set -u3 %flood Stop  
> part $chan  
> msg # ACTION left $remove($chan,#) $+ 's chat   
> }  
> }

I suppose that would do it if you have:

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

Also prevents people from flooding you with join/parts.

---

<div class="post-metadata">

**Author:** ![Wyatt\_Gibbs](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@Wyatt\_Gibbs](https://discuss.dev.twitch.com/u/Wyatt_Gibbs)\
**Post date:** [December 1, 2016, 8:00am UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296/3 "2016-12-01T08:00:51Z")

</div>

Just for my sake what is the Difference between $msgtags(mod).key == 1 and $nick isop # or do both do the same thing? And I have the membership but not the commands. I will add that in.

---

<div class="post-metadata">

**Author:** ![matt\_thomas](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/matt_thomas/32/710_2.png) [@matt\_thomas](https://discuss.dev.twitch.com/u/matt_thomas)\
**Post date:** [December 1, 2016, 10:26am UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296/4 "2016-12-01T10:26:38Z")

</div>

nick isop # will work only if the nicklist is populated. It usually works fine but I have had issues in the past with the list not populating 100% of the time. I’ve never had an issue with the message tags. I suppose it’s just my preference.

---

<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:** [December 31, 2016, 10:26am UTC](https://discuss.dev.twitch.com/t/join-command-for-an-irc-bot/8296/5 "2016-12-31T10:26:39Z")

</div>

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