merl 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
merl/merl.py CHANGED
@@ -2,17 +2,30 @@
2
2
  THANK YOU FOR IMPORTING THE MOST USELESS MODULE EVER CREATED!
3
3
  I hope you hate it!
4
4
 
5
- p.s. Hi, PhoenixSC!
6
5
  ---O9CreeperBoi
6
+
7
+ p.s. Hi, PhoenixSC!
7
8
  """
8
9
 
9
10
  import time
10
11
  import random
12
+ import re
11
13
 
12
14
  CURSOR_UP = "\033[1A"
13
15
  CLEAR = "\x1b[2K"
14
16
  CLEAR_LINE = CURSOR_UP + CLEAR
15
17
 
18
+ match = 0
19
+ global result
20
+ result = 0
21
+ restring = ""
22
+
23
+ # math!
24
+ num = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty one", "twenty two", "twenty three", "twenty four", "twenty five", "twenty six", "twenty seven", "twenty eight", "twenty nine", "thirty", "thirty one", "thirty two", "thirty three", "thirty four", "thirty five", "thirty six", "thirty seven", "thirty eight", "thirty nine", "fourty", "fourty one", "fourty two", "fourty three", "fourty four", "fourty five", "fourty six", "fourty seven", "fourty eight", "fourty nine", "fifty", "fifty one", "fifty two", "fifty three", "fifty four", "fifty five", "fifty six", "fifty seven"] # 57
25
+ ope = ["plus", "minus", "times", "divided by"]
26
+ # LMAO merl can only count up to 57 thats crazy.
27
+
28
+
16
29
  # Oops! Can't have users cursing in MY module!
17
30
  # We don't want to have a repeat of Project Gray Kiwi, now do we?
18
31
  banned = ["pee", "poo", "fuc", "shi", "damn", " hell ", "nig", "bitc", "craft a", "kil", "unaliv", "die", "slas", "end update", "viola", "dam", "frick", "hecking", "sex", "nut", "virgin", "weed", "sucks", "sybau", "shut up", "shut it", "feral", "shish", "gang", "diarrhea"]
@@ -34,12 +47,19 @@ copyin = ["i dont know", "i don't know", "language that vi", "ing higher traff",
34
47
 
35
48
  mine = ["cho minecr", "int minecr", "minecraft!", "say minecr", "ne plus tw"] # im such a troll
36
49
 
37
- # don't ask what this does.
50
+ # hey merl what can you do
51
+ capable = ["you do anyt", "capab", "able", "calcul", "at can you"]
52
+
53
+ # don't ask what these do.
38
54
  m = 0
55
+ num_pattern = "|".join(num)
56
+ ope_pattern = "|".join(ope)
57
+ pattern = rf"\b({num_pattern})\s+((?:{ope_pattern}))\s+({num_pattern})\b"
39
58
 
40
- # every single reply possible
59
+ # every single reply possible that is not math related
41
60
  reply = {
42
- "test":["This is a test for ", "Merl's dialogue. This is still in progress."],
61
+ "test":["This is a test for ", "Merl's dialogue. I can add and subtract!"],
62
+ "cap":["I'm glad you asked! I can", " do basic math with numbers ", "up to fifty seven now. Go on, give ", "me a problem!"],
43
63
  "busy":["We are currently experiencing higher ", "traffic than expected. Please wait ", "a moment and resend your last ", "message."],
44
64
  "movie":["No. No no no. I am not here to talk ", "about the Minecraft Movie. Can you ", "ask me anything besides that?"],
45
65
  "copy":["I'm sorry, but I am designed to be a ", "guide for 'Minecraft', and not to be ", "copied. Can I help you with anything ", "else?"],
@@ -54,6 +74,39 @@ reply = {
54
74
  "englishOnly":["I can only provide support in ", "English right now. Can I help ", "you with a question related ", "to 'Minecraft'?"]
55
75
  }
56
76
 
77
+ def checkmath(inp: str):
78
+ num_map = {word: value for word, value in zip(num, range(len(num)))}
79
+ match = re.search(pattern, inp)
80
+ global restring
81
+ if match:
82
+ num1_word = match.group(1)
83
+ ope_word = match.group(2)
84
+ num2_word = match.group(3)
85
+
86
+ num1 = num_map[num1_word]
87
+ num2 = num_map[num2_word]
88
+ global result
89
+ result = None
90
+
91
+ # calculation times uh9gsigohdfbiushegtfd equals great job thats right!!!
92
+ if ope_word == "plus":
93
+ result = num1 + num2
94
+ restring = f"{num1} plus {num2} is {result}."
95
+ elif ope_word == "minus":
96
+ result = num1 - num2
97
+ restring = f"{num1} minus {num2} is {result}."
98
+ elif ope_word == "times":
99
+ result = num1 * num2
100
+ restring = f"{num1} times {num2} is {result}."
101
+ elif ope_word == "divided by":
102
+ if num2 != 0:
103
+ result = num1 / num2
104
+ restring = f"{num1} divided by {num2} equals {result}."
105
+ else:
106
+ restring = "It is not possible to divide by zero."
107
+ else:
108
+ restring = ""
109
+
57
110
 
58
111
  def replyMsg(cate: str):
59
112
  a = ""
@@ -73,6 +126,10 @@ def printanim(msg: str):
73
126
 
74
127
  # this is what you send to nerl if you are simply pimply
75
128
  def sendRaw(prompt: str):
129
+ global result
130
+ result = None
131
+ checkmath(prompt)
132
+ match = 0
76
133
  global m
77
134
  if prompt == "copyInput":
78
135
  m = 1
@@ -93,6 +150,7 @@ def sendRaw(prompt: str):
93
150
  else:
94
151
  if any(sub.lower() in prompt.lower() for sub in copyin): return replyMsg("copy")
95
152
  elif any(sub.lower() in prompt.lower() for sub in banned): return replyMsg("languageViolation")
153
+ elif any(sub.lower() in prompt.lower() for sub in capable): return replyMsg("cap")
96
154
  elif any(sub.lower() in prompt.lower() for sub in future): return replyMsg("update")
97
155
  elif any(sub.lower() in prompt.lower() for sub in pb): return replyMsg("pb")
98
156
  elif any(sub.lower() in prompt.lower() for sub in help): return replyMsg("iCanHelp") # can you really?
@@ -100,10 +158,14 @@ def sendRaw(prompt: str):
100
158
  elif any(sub.lower() in prompt.lower() for sub in cj): return replyMsg("movie")
101
159
  elif any(sub.lower() in prompt.lower() for sub in greet): return replyMsg("greet")
102
160
  else:
103
- g = random.randint(0,4)
104
- if g == 1: return replyMsg("idk2")
105
- elif g == 2: return replyMsg("englishOnly")
106
- else: return replyMsg("idk") # ha ha!
161
+ if result != None:
162
+ return restring
163
+ else:
164
+ g = random.randint(0,7)
165
+ if g == 1: return replyMsg("idk2")
166
+ elif g == 2: return replyMsg("englishOnly")
167
+ elif g == 5: return "I can't help with that." # seriously this one is new.
168
+ else: return replyMsg("idk") # ha ha!
107
169
 
108
170
 
109
171
  # this is what you send to berl if you are fancy pantsy
@@ -124,6 +186,9 @@ def send(pr: str):
124
186
 
125
187
  # tree of importance
126
188
  def replyPrint(prompt: str):
189
+ global result
190
+ result = None
191
+ checkmath(prompt)
127
192
  time_tuple = time.localtime()
128
193
  hour = time_tuple.tm_hour
129
194
  global pb, banned, greet, help, cj, copyin
@@ -134,6 +199,8 @@ def replyPrint(prompt: str):
134
199
  for x in range(len(reply["copy"])): printanim(reply["copy"][x])
135
200
  elif any(sub.lower() in prompt.lower() for sub in banned):
136
201
  for x in range(len(reply["languageViolation"])): printanim(reply["languageViolation"][x])
202
+ elif any(sub.lower() in prompt.lower() for sub in capable):
203
+ for x in range(len(reply["cap"])): printanim(reply["cap"][x])
137
204
  elif any(sub.lower() in prompt.lower() for sub in future):
138
205
  for x in range(len(reply["update"])): printanim(reply["update"][x])
139
206
  elif any(sub.lower() in prompt.lower() for sub in pb):
@@ -147,15 +214,21 @@ def replyPrint(prompt: str):
147
214
  elif any(sub.lower() in prompt.lower() for sub in greet):
148
215
  for x in range(len(reply["greet"])): printanim(reply["greet"][x])
149
216
  else:
150
- g = random.randint(0,4)
151
- if g == 1:
152
- for x in range(len(reply["idk2"])): printanim(reply["idk2"][x])
153
- elif g == 2:
154
- for x in range(len(reply["englishOnly"])): printanim(reply["englishOnly"][x])
217
+ if result != None:
218
+ printanim(restring)
155
219
  else:
156
- # The statement to end all statements.
157
- # Behold. The one, the legend, the answer supreme...
158
- printanim("I don't know.")
159
- # This won't change, either.
220
+ g = random.randint(0,7)
221
+ if g == 1:
222
+ for x in range(len(reply["idk2"])): printanim(reply["idk2"][x])
223
+ elif g == 2:
224
+ for x in range(len(reply["englishOnly"])): printanim(reply["englishOnly"][x])
225
+ elif g == 3:
226
+ printanim("I can't help with that.")
227
+ # this one is new. they actually said this and idk why.
228
+ else:
229
+ # The statement to end all statements.
230
+ # Behold. The one, the legend, the answer supreme...
231
+ printanim("I don't know.")
232
+ # This won't change, either.
160
233
 
161
234
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: merl
3
- Version: 0.1.2
4
- Summary: A useless python lybrary
3
+ Version: 0.1.3
4
+ Summary: A useless python library, aiming to emulate (not fetch/embed) the Merl experience found on the minecraft.net help page! Again, this is NOT the real Merl, but a really close copy! If you use it enough!
5
5
  Home-page: https://github.com/O9Creeps/merl
6
6
  Author: O9CreeperBoi
7
7
  Author-email: example@example.com
@@ -0,0 +1,6 @@
1
+ merl/__init__.py,sha256=z--UomdGJ1AOwNBeHlMD0uip2ehFLn8Lp_x3UP8JpHw,20
2
+ merl/merl.py,sha256=iNmvMAZPS6SzoZnYV6dNL3YTBSk0-M5c5L8rsWUNYj0,9841
3
+ merl-0.1.3.dist-info/METADATA,sha256=KbQpxJEtQBKG9AgxTWF4R0AGYjLxq-lNMZbW9k3wlMs,953
4
+ merl-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ merl-0.1.3.dist-info/top_level.txt,sha256=ivpualOj-EqXImlSl3Kb5GKJB1jlzFwn2anAsxaKgXA,5
6
+ merl-0.1.3.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- merl/__init__.py,sha256=z--UomdGJ1AOwNBeHlMD0uip2ehFLn8Lp_x3UP8JpHw,20
2
- merl/merl.py,sha256=DuRXs--cjHUYXCywUc3VqPBLvoq3k1tewMD9fablnEY,6810
3
- merl-0.1.2.dist-info/METADATA,sha256=rDCunDQNYowjxLc_jyTRTR0dSbh-CbrYfZG8tK_y6Es,777
4
- merl-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- merl-0.1.2.dist-info/top_level.txt,sha256=ivpualOj-EqXImlSl3Kb5GKJB1jlzFwn2anAsxaKgXA,5
6
- merl-0.1.2.dist-info/RECORD,,
File without changes