modules/CommandRoom.py
authorSomeone <someone@somenet.org>
Mon, 5 Sep 2022 19:27:01 +0000 (21:27 +0200)
committerSomeone <someone@somenet.org>
Mon, 5 Sep 2022 19:27:01 +0000 (21:27 +0200)
modules/CommandRoom.py

index 834a9c1e5358b5b9e61d5549db8e6e0f9da30e0d..3c1fb658070eb6d95d0c30253fb208855dc24fdc 100644 (file)
@@ -30,12 +30,12 @@ class CommandRoom(AbstractCommand):
             send_to_chan = True
 
         if not search or search == "--chan":
-            request.cmd_respond_text_temp("You did not provide a room name.\n``/"+self.TRIGGER+" "+data["text"]+"``")
+            request.respond_cmd_err("``/"+self.TRIGGER+"`` you did not provide a room name. :(")
             return
 
         r = requests.get(self.toss_url_api_search+"?q="+requests.utils.quote(search))
         if r.status_code != 200:
-            request.cmd_respond_text_temp(":stop_sign: TOSS-query failed. :(\n"+str(repr(r))+"\n``/"+self.TRIGGER+" "+data["text"]+"``")
+            request.respond_cmd_err("``/"+self.TRIGGER+"`` TOSS-query failed. :(\n"+str(repr(r))+"\n``/"+self.TRIGGER+" "+data["text"]+"``")
             return
 
         msg = "#### ** [:toss: ``Results``](https://toss.fsinf.at/?q="+requests.utils.quote(search)+") ``(max 5)``**"
@@ -47,15 +47,15 @@ class CommandRoom(AbstractCommand):
                     break
 
                 msg += "\n#### "+entry["name"]+" ("+entry["code"]+")\n"
-                if entry["address"]:
+                if "address" in entry:
                     msg += ":world_map:[``"+entry["address"]+"``](https://www.google.com/maps/search/"+requests.utils.quote(entry["address"].split(";")[0])+")"
-                if entry["description"]:
+                if "description" in entry:
                     msg += "\n"+entry["description"]
                 msg += "\n\n----\n\n"
 
         if cnt == 0:
-            request.cmd_respond_text_temp("#### **``No`` :toss: ``Results``** :(\n``/"+self.TRIGGER+" "+data["text"]+"``")
+            request.respond_cmd_err("#### **``No`` :toss: ``Results``** :(\n``/"+self.TRIGGER+" "+data["text"]+"``")
         elif not send_to_chan:
-            request.cmd_respond_text_temp(msg+"\n``/"+self.TRIGGER+" "+data["text"]+"``")
+            request.respond_cmd_temp(msg+"\n``/"+self.TRIGGER+" "+data["text"]+"``")
         else:
-            request.cmd_respond_text_chan(msg+"\n``/"+self.TRIGGER+" "+data["text"]+"``")
+            request.respond_cmd_chan(msg+"\n``/"+self.TRIGGER+" "+data["text"]+"``")