Skip to content

Instantly share code, notes, and snippets.

@shawnco
Created July 6, 2022 00:25
Show Gist options
  • Save shawnco/3335707a020aa90644e760fe96966710 to your computer and use it in GitHub Desktop.
Save shawnco/3335707a020aa90644e760fe96966710 to your computer and use it in GitHub Desktop.
Twitch Bot Idle Game section 1
{
"username": "shawntc",
"password": "oauth:xxxxxxxxxxxxx",
"channels": ["shawntc"]
}
const {Sequelize} = require('sequelize');
const db = new Sequelize({
dialect: 'sqlite',
storage: __dirname + '/idle.sqlite'
});
const Upgrade = db.define('upgrade', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: Sequelize.STRING,
cost: Sequelize.INTEGER,
points: Sequelize.INTEGER
}, {
freezeTableName: true,
timestamps: false
});
const tmi = require('tmi.js');
const {username, password, channels} = require('./config.json');
const client = new tmi.Client({
options: {
debug: true,
messagesLogLevel: 'info'
},
connection: {
reconnect: true,
secure: true
},
identity: {
username, password
},
channels
});
try {
client.connect();
} catch (ex) {
console.log('Problem connecting:', ex);
}
client.on('message', (channel, tags, message, self) => {
console.log(channel, message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment