Added basic user class

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

17
tbot.py
View File

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