diff --git a/miku/plugins/notiz.lua b/miku/plugins/notiz.lua new file mode 100644 index 0000000..1f76a11 --- /dev/null +++ b/miku/plugins/notiz.lua @@ -0,0 +1,31 @@ +local notiz = {} + +local help_text + +function notiz:init(config) + notiz.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('note', true):t('notiz', true).table + notiz.doc = [[* +]]..config.cmd_pat..[[notiz* __: Sendet eine Nachricht an dich selbst]] +end + +function notiz:action(msg, config) + if msg.chat.type == 'private' then + utilities.send_reply(msg, 'Du solltest dieses Plugin nur in Gruppen nutzen!') + return + end + + local input = utilities.input_from_msg(msg) + if not input then + utilities.send_reply(msg, notiz.doc, true) + return + end + + local res = utilities.send_message(msg.from.id, input, true, nil, true) + if not res then + utilities.send_reply(msg, 'Bitte schreibe mir zuerst [privat](http://telegram.me/' .. self.info.username .. '?start=note)!', true) + else + utilities.send_reply(msg, 'Du hast eine PN ;)') + end +end + +return notiz \ No newline at end of file