aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-29 17:15:54 +0000
committerGravatar jesopo2020-01-29 17:15:54 +0000
commit616eb84264b5d21a25ce0355d6f744fdb3aeb644 (patch)
tree5b984cac953563f7fa3cefa0dd46b84544405f24 /modules
parentSpecArgumentTypeString should return None when no args (diff)
signature
add "lstring" command spec; "last string" - explicit args or last message
Diffstat (limited to 'modules')
-rw-r--r--modules/translate.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/modules/translate.py b/modules/translate.py
index e11de291..3f31f224 100644
--- a/modules/translate.py
+++ b/modules/translate.py
@@ -10,19 +10,14 @@ REGEX_LANGUAGES = re.compile("(\w+)?:(\w+)? ")
class Module(ModuleManager.BaseModule):
@utils.hook("received.command.tr", alias_of="translate")
@utils.hook("received.command.translate")
+ @utils.spec("!<phrase>lstring")
def translate(self, event):
"""
:help: Translate the provided phrase or the last line in thie current
channel
:usage: [phrase]
"""
- phrase = event["args"]
- if not phrase:
- phrase = event["target"].buffer.get()
- if phrase:
- phrase = utils.irc.strip_font(phrase.message)
- if not phrase:
- raise utils.EventError("No phrase provided.")
+ phrase = event["spec"][0]
source_language = "auto"
target_language = "en"