forked from gabutsceo/SimpTron-3000
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpTron.py
More file actions
63 lines (58 loc) · 2.79 KB
/
simpTron.py
File metadata and controls
63 lines (58 loc) · 2.79 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import json,time
import random
import text2emotion as te
from config import getResponses, getScope, getMisc
import discAutoMsg.discord_automessage as discAutoMsg
daComplimentList,daDefenseList,daAngryResponseList,daHappyResponseList,daSadResponseList,daFearfulResponseList, daSurprisedResponseList = getResponses()
reactTo,channelIDtoMsg = getScope()
msgAsReply,msgPingReply = getMisc()
def createCompliment(emotions):
print("Creating Compliment")
highest = 0.0
daEmotion = ""
daMessage = ""
for emotion in emotions:
if emotions[emotion] > highest:
print(emotions[emotion])
highest = emotions[emotion]
daEmotion = emotion
print(daEmotion)
daMessage = ""
if daEmotion == "Happy":
daMessage += daHappyResponseList[random.randint(0,len(daHappyResponseList))-1]
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
elif daEmotion == "Angry":
daMessage += daAngryResponseList[random.randint(0,len(daAngryResponseList))-1]
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
elif daEmotion == "Surprise":
daMessage += daSurprisedResponseList[random.randint(0,len(daSurprisedResponseList))-1]
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
elif daEmotion == "Sad":
daMessage += daSadResponseList[random.randint(0,len(daSadResponseList))-1]
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
elif daEmotion == "Fear":
daMessage += daFearfulResponseList[random.randint(0,len(daFearfulResponseList))-1]
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
elif daEmotion == "":
daMessage += daComplimentList[random.randint(0,len(daComplimentList))-1]
return daMessage
while True:
# print("Start of Loop")
for channelID in list(channelIDtoMsg.keys()):
#print("Start of for loop")
daRecentMessage = discAutoMsg.getMessages(channelID,1,False)[0]
if daRecentMessage != channelIDtoMsg[channelID]:
daMessageID = daRecentMessage["id"]
daMessageText = daRecentMessage["content"]
print(daRecentMessage)
channelIDtoMsg[channelID] = daRecentMessage
if channelIDtoMsg[channelID]["author"]["id"] == reactTo:
discAutoMsg.displayTyping(channelID,2)
print(daMessageText)
print(te.get_emotion(daMessageText))
daEmotionParam = te.get_emotion(daMessageText)
if msgAsReply == False:
discAutoMsg.sendMessage(channelID, createCompliment(daEmotionParam))
else:
discAutoMsg.sendReply(channelID, createCompliment(daEmotionParam),daMessageID)
time.sleep(.25)