Kirk Trombley 6 жил өмнө
parent
commit
f82d6f8ed1
4 өөрчлөгдсөн 12 нэмэгдсэн , 5 устгасан
  1. 0 3
      TODO_commands
  2. 5 0
      config/config.toml
  3. 1 0
      src/config.py
  4. 6 2
      src/rollbot.py

+ 0 - 3
TODO_commands

@@ -7,6 +7,3 @@ new:
 reminders
 spoiler jar
 curse
-
-other:
-aliasing system

+ 5 - 0
config/config.toml

@@ -8,6 +8,11 @@ roll = [ "roll" ]
 querying = [ "inspire", "shield", "scp", "riddle" ]
 seychelles = [ "seychelles" ]
 
+[aliases]
+speemteek = "speamteek"
+interpret = "inspire"
+horoscope = "inspire"
+
 [teamspeak]
 host = "kirkleon.ddns.net"
 user = "serveradmin"

+ 1 - 0
src/config.py

@@ -30,5 +30,6 @@ BOTS_LOOKUP = get_secret("bots")
 GLOBAL_ADMINS = get_secret("auths.global")
 GROUP_ADMINS = get_secret("auths.group")
 PLUGINS = get_config("plugins")
+ALIASES = get_config("aliases")
 API_KEY = get_secret("api_key")
 DB_FILE = os.path.abspath(get_config("database"))

+ 6 - 2
src/rollbot.py

@@ -1,7 +1,7 @@
 import importlib
 
 import db
-from config import PLUGINS, BOTS_LOOKUP
+from config import PLUGINS, ALIASES, BOTS_LOOKUP
 from command_system import RollbotResponse, RollbotFailure
 
 
@@ -40,7 +40,11 @@ class Rollbot:
             self.logger.warn(f"Tried to run non-command message {message.message_id}")
             return
 
-        plugin = self.commands.get(message.command, None)
+        if message.command in ALIASES:
+            plugin = self.commands.get(ALIASES[message.command], None)
+        else:
+            plugin = self.commands.get(message.command, None)
+
         if plugin is None:
             response = RollbotResponse(message, failure=RollbotFailure.INVALID_COMMAND)
         else: