Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- import webbrowser
- import tkSimpleDialog
- import sys
- import socket
- import string
- host = "irc.chat.twitch.tv"
- port = 6667
- channel = 'SeedPodGames'
- readbuffer = ''
- def GetAuthToken():
- webbrowser.open(url = 'http://www.twitchapps.com/tmi/')
- def get_authtxt():
- userid = tkSimpleDialog.askstring('Twitch Username', "Twitch Username:")
- tokenid = tkSimpleDialog.askstring('OAuthToken Prompt', "OAuth Token:")
- print (tokenid)
- nick = (userid)
- password = (tokenid)
- s = socket.socket()
- s.connect((host, port))
- s.send('%s\r\n' % password)
- s.send('%s\r\n' % nick)
- s.send('JOIN %s\r\n' %channel)
- s.send('PRIVMSG %s Hi!\r\n' %channel)
- while 1:
- readbuffer = readbuffer + s.recv(1024)
- temp = string.split(readbuffer, "\n")
- readbuffer = temp.pop()
- for line in temp:
- line = string.rstrip(line)
- line = string.split(line)
- if (line[0] == "PING"):
- s.send("PONG %s\r\n" % line[1])
- ##Debug
- ## print "Connecting to, %s on port %s with user %s and password %s" %(host, port, nick, password)
- ##Window title and geometry
- root = Tk()
- root.wm_title('Slimes Remote')
- root.geometry('450x450')
- ##Menu items
- menu = Menu(root)
- label1_1 = Label(root, text='OAuthToken')
- entry_1 = Entry(root)
- root.config(menu=menu)
- ##Submenu items
- subMenu = Menu(menu)
- menu.add_cascade(label='Actions', menu=subMenu)
- subMenu.add_command(label='Get Auth Token', command = GetAuthToken)
- ##Position objects
- ##Stuff Goes here
- ##Add Connect button
- button_1 = Button(root, text='Connect', command= get_authtxt)
- button_1.grid(row=1)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement