Skip to content

Instantly share code, notes, and snippets.

@NexInfinite
Created May 13, 2018 18:07
Show Gist options
  • Save NexInfinite/af41bbc65adcf4e6552d7ad2d30bc6ed to your computer and use it in GitHub Desktop.
Save NexInfinite/af41bbc65adcf4e6552d7ad2d30bc6ed to your computer and use it in GitHub Desktop.
import os
import sqlite3
from No3rdPartLibTwitchBot import IRC
from configno3rdparty import *
from SQLiteCommands import *
import shlex
import re
AUTH = oauthconfig
SERVER = serverconfig
PORT = portconfig
CHANNEL = channel_nameconfig
NICK = nicknameconfig
response = None
def main(irc):
if AUTH is None:
print("ERROR! You did not provide a AUTH key")
running = True
irc.send('Hello streamer, How are you today?')
while running:
user, msg = irc.get_msg()
response = None
if msg == 'PING :tmi.twitch.tv':
irc.ping()
elif msg.startswith('!userman'):
response = f'Userman????? More like HelperMan'
elif msg.startswith('!sudokid'):
response = f'SudoKid?!?!?!? Never heard of him?'
elif msg.startswith('hello'):
response = f'Hello @{user[0]}, how are you today?'
elif msg.startswith('!ADDCOMNEX'):
split_message = shlex.split(msg)
insert_cmd(
command_given=split_message[1],
response_given=split_message[2:]
)
if response is not None:
irc.send(response)
if __name__ == '__main__':
irc_server = IRC(SERVER, PORT, NICK, CHANNEL, AUTH)
irc_server.connect()
try:
main(irc_server)
except KeyboardInterrupt:
irc_server.diconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment