Channel not found


#1

Hello, guys!
I wanted to create my own twitch chat bot, but something went wrong. My account’s channel on twitch is qowevisa. And so I wrote in .env file “CHANNEL=qowevisa”.
In my bot.py file I wrote these lines:


bot = commands.Bot(
irc_token=os.environ[‘TMI_TOKEN’],
client_id=os.environ[‘CLIENT_ID’],
nick=os.environ[‘BOT_NICK’],
prefix=os.environ[‘BOT_PREFIX’],
initial_channels=[os.environ[‘CHANNEL’]]
)


BUT. When I’m writing “pipenv run python bot.py” in my window’s shell, it returns me that kind of error


I’d like to know that’s a typical error, but eighter I’m not so smart, or it is something strange.


#2

At a guess you need

CHANNEL=#qowevisa

But depends on the program. Channels are preceeded with a # for joining purposes. Like IRC


#3

Thanks for very fast replying, but it didn’t fix the problem.


I tried to rename “the owner” in twitch developers tab, but only when I set every name to my own name it stopped sending me errors. It just was trying to load variables. I think it stopped working because in the channel was a viewer with the name “qowevisa”.


#4

Then the issue is somewhere else in the program you have written. Which we can’t really debug because it’s your program.

We’d need to see the source.

The name in the Twitch Developers tab/console. Assuming you mean https://dev.twitch.tv/console/ the “name” has no bearing on your programs operation.


#5

I was copying the code and everything from
https://dev.to/ninjabunny9000/let-s-make-a-twitch-bot-with-python-2nd8
But they said nothing about how shall I fill the .env file.
Just to clear everything.
Screenshot_56
In my .env file TMI_TOKEN is oauth from https://twitchapps.com/tmi/
CLIENT_ID is Client_id in my app in twitch dev
BOT_NICK is just a name and I can set it to whatever I want
CHANNEL is my twitch account

Is it like that? If it is, okay, I’ll close this topic if I can and just go try it one more time and go trying to solve the problem by my own.


#6

That’s useful

Try

CHANNEL="#qowevisa"

in your .env the code seems to drop the ‘#’ so it’s not joining the channel. I’m not 100% familiar with python env file usage.

Could just skip using env for now and hardcode it to get your bot going.

There is also someone in the comments on the devto post with the same issue with no resolution…


#7

Okay. So. I’m really dumb. I was trying to create a bot from my own acc. So I created another acc and everything is fine.
So, I think if .env and code are fine, your problem is that you’re trying to create yourself into a bot…


#8

But the code should of worked fine using your account, as it authenticates using username + oAuth. shrug


#9

shrug