Skip to content

Commit b94983b

Browse files
author
Simon Cooksey
committed
Revert "Added overwrite to commands and made aliases require overwrite to re-write"
This reverts commit 0db78fc.
1 parent 0db78fc commit b94983b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

piperbot.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ def handle_message(self, message):
268268
first = message.text[1:].split()[0]
269269
if first == "alias":
270270
self.handle_alias_assign(message)
271-
elif first == "overwrite":
272-
self.handle_alias_assign(message, overwrite=True)
273271
elif first in self.commands or first in self.aliases:
274272
self.worker_pool.apply_async(self.handle_command, args=(message,))
275273

@@ -311,17 +309,14 @@ def call_triggered(self, func, message, pre=[], post=[]):
311309
print("*** print_tb:")
312310
traceback.print_tb(exc_traceback, file=sys.stdout)
313311

314-
def handle_alias_assign(self, message, overwrite=False):
312+
def handle_alias_assign(self, message):
315313
try:
316314
name, *alias = message.text[len(self.command_char)+5:].split("=")
317315
name = name.strip()
318316
alias = "=".join(alias).strip()
319317
if name in self.commands:
320318
raise Exception("cannot overwrite existing command")
321319

322-
if name in self.aliases and not overwrite:
323-
raise Exception("alias already exists. Use the overwrite command to override.")
324-
325320
commands = map(lambda x: [(command, " ".join(args)) for command, *args in [x.split(" ")]][0],
326321
map(lambda x: x.strip(), alias.split(" || ")))
327322
funcs = []

0 commit comments

Comments
 (0)