-
Notifications
You must be signed in to change notification settings - Fork 6
/
Index.ts
37 lines (27 loc) · 1.01 KB
/
Index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { TwitchChat} from 'https://deno.land/x/tmi/mod.ts';
import { config } from "https://deno.land/x/dotenv/mod.ts";
import { comandos } from './Commands.ts';
// import { ProhibitedWords } from './ProhibitedWords.ts';
// import { TimeOut } from './TimeOut.ts';
//Valores criados em um .env
const{twitchtoken, twitchchannel, twitchbot} = config();
const tc = new TwitchChat(twitchtoken, twitchbot);
try {
await tc.connect();
const channel = tc.joinChannel(twitchchannel);
channel.addEventListener('privmsg', (ircMsg) => {
if (Object.getOwnPropertyNames(comandos).includes(ircMsg.message)) {
channel.send(comandos[ircMsg.message]);
}
// if (ProhibitedWords.find(word => {
// return !!ircMsg.message.includes(word)
// })){
// TimeOut(ircMsg, channel)
// }
});
console.log('funcionando');
} catch (err) {
console.error(err)
tc.disconnect();
}
//comando para execução: deno run --allow-net --allow-read ./Index.ts