A bot to auto host twitch channels by another channel, through automatic draw.
This bot is based on the twitch-bot. If you want to learn more about possible functions, access the twitch-bot NPM here: twitch-bot.
Use node bot.js
or if you prefer updating without having to close, use nodemon bot.js
.
First, enter the main file, bot.js
. There are two variables that define the name of the channel which will be the bot and the prefix used for the commands.
Variable name | Default | Description |
---|---|---|
channelName | null |
It is the name which will be the bot. It must be the same as the twitch username. |
prefix | ! |
Prefix used to call commands. |
For the login of the bot to be carried out, the usual password is not used, for this, oauth is used. To have oauth from the bot account, access the following link: twitch oauth.
const Bot = new TwitchBot({
username: channelName,
oauth: 'oauth:8df8f12vbu8v7u98vu7238v2mm',
channels: [channelName]
})
The channels is where all the channels that the bot will be. Because it is a bot with the idea of auto host, the channelName
variable was used to leave only the channel itself. If you are making a bot for another purpose, the channels should be divided by a comma (eg: [kekw, PogU, Pepega]).
There are two possibilities for adding new commands:
commands
directory, with the file name being the name of the command. (recommended). In the new file, use the code bellow and script your code inside.exports.run = async (Bot, message, username, subscriber, mod) => {
//code inside
}
if
inside Bot.on('message')
. (not recommended)if(chatter.message === '!test') {
Bot.say('Command executed! PogChamp')
}
My native language is not English, so this tutorial is probably not well translated. If you are interested, help me.
We can always improve and optimize the code! If you see any inconsistencies, errors or possible improvements, help the community!