-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCommandHelper.py
More file actions
153 lines (140 loc) · 6.85 KB
/
Copy pathCommandHelper.py
File metadata and controls
153 lines (140 loc) · 6.85 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import re
from DataBuilder import Data
data = Data()
def command_parse(author, message):
#Data lookup patterns
rchaospattern = r"\A!r-?chaos"
rcommandpattern = r"\A!r-?\w*"
wcommandpattern = r"\A![w|?|3x]-\w*"
skillpattern = r"\A!skill\s.*"
bosspattern = r"\A!boss\s.*"
codepattern = r"\A!code[s]?\s\w*"
itempattern = r"\A!item\s.*"
specialequipmentpattern = r"\A!specialequipment\s.*"
specialweaponpattern = r"\A!specialweapon\s.*"
statuseffectpattern = r"\A!statuseffect\s\.*"
rootpattern = r"\A!base\s.*"
communitycommandpattern = r"\A!.*"
#General command patterns
hellopattern = r"\A!hello"
commandspattern = r"\A!command[s]?"
beyondchaospattern = "\A!beyondchaos"
discordpattern = r"\A!discord"
getbcpattern = r"\A!getbc"
permadeath = r"\A!permadeath"
aboutpattern = r"\A!about"
if re.search(rchaospattern, message, re.IGNORECASE):
return "It's literally every spell/skill in the game in one spellset. Threat:(8/255)"
elif re.search(rcommandpattern, message, re.IGNORECASE):
try:
temp = re.sub("!", "", message).lower()
return (data.random_skillsets[temp])
except:
#in case someone enteres a community command that starts with "r"
try:
temp = re.sub("!", "", message).lower()
return (data.commands[temp])
except:
return "Null"
elif re.search(wcommandpattern, message, re.IGNORECASE):
return "W-/?-/3x-[spellset] is just like r-[spellset] but " \
"gets cast more than once. NOTE: These spellsets that " \
"include Spiraler, Quadra Slam, and/or Quadra Slice will " \
"not cast those spells!"
elif re.search(skillpattern, message, re.IGNORECASE):
try:
temp = re.sub("!skill ", "", message).lower()
return (data.skill_parameters[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(bosspattern, message, re.IGNORECASE):
try:
temp = re.sub("!boss ", "", message).lower()
return (data.boss_moves[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(codepattern, message, re.IGNORECASE):
try:
temp = re.sub("!code ", "", message).lower()
return (data.codes[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(itempattern, message, re.IGNORECASE):
try:
temp = re.sub("!item ", "", message).lower()
return (data.item_table[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(specialequipmentpattern, message, re.IGNORECASE):
try:
temp = re.sub("!specialequipment ", "", message).lower()
return (data.special_equipment[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(specialweaponpattern, message, re.IGNORECASE):
try:
temp = re.sub("!specialweapon ", "", message).lower()
return (data.special_weapons[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again.")
elif re.search(statuseffectpattern, message, re.IGNORECASE):
try:
temp = re.sub("!statuseffect ", "", message).lower()
return (data.status_effects[temp])
except:
pass
elif re.search(rootpattern, message, re.IGNORECASE):
try:
temp = re.sub("!base ", "", message)
return (data.root_table[temp])
except:
return (f"Sorry, could not find {temp}. Please check your spelling "
f"and try again. REMEBER: capitalization matters!")
elif re.search(hellopattern, message, re.IGNORECASE):
return f"Hello {author}!"
elif re.search(commandspattern, message, re.IGNORECASE):
return "Basic commands: !hello, !about, !getBC, !discord, !beyondchaos, !permadeath " \
"<!R[spell] commands: ex.'!RTime'> " \
"<!Skill [SkillName] commands: ex.'!skill fire 3'> " \
"<!Boss [BossName] commands: ex. '!boss Kefka3'> " \
"<!Code [CodeName] commands: ex. '!code capslockoff'> " \
"<!Item [ItemName] commands: ex. '!item potion'> " \
"<!StatusEffect [EffectName] commands: ex: '!statuseffect poison'> " \
"<!Base [SkillBase] commands: ex. '!base Fir'> " \
"<!SpecialEquipment [EquipName] commands: ex. '!specialequipment red duster'> " \
"<!SpecialWeapons [WeaponName] commands: ex. '!specialweapon portal gun'>"
elif re.search(beyondchaospattern, message, re.IGNORECASE):
return "Originally developed by Abyssonym, but now maintained by SubtractionSoup, " \
"Beyond Chaos is a randomizer, a program that remixes game content randomly, " \
"for FF6. Every time you run Beyond Chaos, it will generate a completely unique, " \
"brand-new mod of FF6 for you to challenge and explore. There are over 10 billion " \
"different possible randomizations! Nearly everything is randomized, " \
"including treasure, enemies, colors, graphics, character abilities, and more."
elif re.search(getbcpattern, message, re.IGNORECASE):
return "Current EX version by SubtractionSoup: https://github.com/subtractionsoup/beyondchaos/releases/latest"
elif re.search(discordpattern, message, re.IGNORECASE):
return "Check out the Beyond Chaos Barracks - https://discord.gg/S3G3UXy"
elif re.search(permadeath, message, re.IGNORECASE):
return "Permadeath means starting a new randomized game upon game over"
elif re.search(aboutpattern, message, re.IGNORECASE):
return "CecilBot is a program to help players by providing a list of skills and " \
"spells within each skill-set. CecilBot was made by GreenKnight5 and inspired by " \
"FF6Rando community member Cecil188, and uses databases authored by Cecil188. " \
"Please PM any questions, comments, concerns to @GreenKnight5 or @Cecil188."
elif re.search(communitycommandpattern, message, re.IGNORECASE):
try:
temp = re.sub("!", "", message).lower()
return (data.commands[temp])
except:
return "Null"
else:
return "Null"
# for testing
if __name__ == "__main__":
print(command_parse("greenKnight5", "!r-chaos"))