# Python twitch bot code example

**URL:** <https://discuss.dev.twitch.com/t/python-twitch-bot-code-example/14171>\
**Category:** Chat and IRC\
**Created:** [February 8, 2018, 1:47am UTC](https://discuss.dev.twitch.com/t/python-twitch-bot-code-example/14171 "2018-02-08T01:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkubatko](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dkubatko/32/4100_2.png) [@dkubatko](https://discuss.dev.twitch.com/u/dkubatko)\
**Post date:** [February 8, 2018, 1:47am UTC](https://discuss.dev.twitch.com/t/python-twitch-bot-code-example/14171/1 "2018-02-08T01:47:33Z")

</div>

I am trying to make [https://github.com/TwitchDev/chat-samples/tree/master/python](https://github.com/TwitchDev/chat-samples/tree/master/python) code example to work. I’ve created account for my bot, generated auth token, copied client id however class method on\_welcome never gets called.  
When I connect to IRC via sockets that’s the output:  
:tmi.twitch.tv 001 codexchatbot :Welcome, GLHF!  
:tmi.twitch.tv 002 codexchatbot :Your host is [tmi.twitch.tv](http://tmi.twitch.tv)  
:tmi.twitch.tv 003 codexchatbot :This server is rather new  
:tmi.twitch.tv 004 codexchatbot :-  
:tmi.twitch.tv 375 codexchatbot :-  
:tmi.twitch.tv 372 codexchatbot :You are in a maze of twisty passages, all alike.  
:tmi.twitch.tv 376 codexchatbot :\>

:codexchatbot!codexchatbot@codexchatbot.tmi.twitch.tv JOIN

:codexchatbot.tmi.twitch.tv 353 codexchatbot = :bot  
:codexchatbot.tmi.twitch.tv 366 codexchatbot :End of /NAMES list

And new messages never get printed.  
Please help!

---

<div class="post-metadata">

**Author:** ![501.legion](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/501.legion/32/5585_2.png) [@501.legion](https://discuss.dev.twitch.com/u/501.legion)\
**Post date:** [February 8, 2018, 10:06pm UTC](https://discuss.dev.twitch.com/t/python-twitch-bot-code-example/14171/2 "2018-02-08T22:06:41Z")

</div>

Seems you need a channelname. Just send “JOIN #channelname” instead of “JOIN”. Replace ‘channelname’ with your channel

---

<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:** [March 10, 2018, 10:06pm UTC](https://discuss.dev.twitch.com/t/python-twitch-bot-code-example/14171/3 "2018-03-10T22:06:47Z")

</div>

Closed on March 10, 2018, 10:06pm UTC

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