Added basic user class

This commit is contained in:
Benjamyn Love 2019-12-30 19:38:41 +11:00
parent 5290447531
commit ba66b7935b

15
tbot.py
View File

@ -4,7 +4,7 @@ import re
import json import json
with open(".twitchcreds") as file: with open(".twitchcreds") as file:
botSettings = json.loads(file.read()) botSettings = json.loads(file.read())#
UserID = botSettings[0]['OAUTH'] UserID = botSettings[0]['OAUTH']
PREFIX = '!' PREFIX = '!'
@ -17,11 +17,14 @@ userstats = {}
permitURL = [] permitURL = []
class UserData:
def __init__(self, username):
self.username = username
self.mod = username in botSettings[1]["MODS"]
def isURL(message): def isURL(message):
rule = re.compile("http(|s)[;:]\/\/.*\..*") rule = re.compile("http(|s)[;:]\/\/.*\..*")
if rule.findall(message): return rule.findall(message)
return True
return False
def handle_message(message: twitch.chat.Message) -> None: def handle_message(message: twitch.chat.Message) -> None:
@ -80,7 +83,7 @@ def handle_message(message: twitch.chat.Message) -> None:
else: else:
pass pass
print(userstats) # print(userstats)
def main(): def main():
chat = twitch.Chat(channel='#aztecdude1', chat = twitch.Chat(channel='#aztecdude1',
@ -94,5 +97,5 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()
print(botSettings)
#print(isURL("https://google.com")) #print(isURL("https://google.com"))
print(test.mod)