From c77ac7fbc3c4aae3d0cae500f146923c807a5ea3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 29 Mar 2019 11:25:21 +0100 Subject: [PATCH] Add ciaoruozi command --- royalnet/bots/telegram.py | 2 +- royalnet/commands/ciaoruozi.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 royalnet/commands/ciaoruozi.py diff --git a/royalnet/bots/telegram.py b/royalnet/bots/telegram.py index 5f7a070b..e82aa716 100644 --- a/royalnet/bots/telegram.py +++ b/royalnet/bots/telegram.py @@ -81,7 +81,7 @@ class TelegramBot: # Skip inexistent commands command = self.missing_command # Call the command - return await self.Call(message.chat, command, *parameters).run() + return await self.Call(message.chat, command, *parameters, update=update).run() async def handle_net_request(self, message: Message): pass diff --git a/royalnet/commands/ciaoruozi.py b/royalnet/commands/ciaoruozi.py new file mode 100644 index 00000000..4c6d0f13 --- /dev/null +++ b/royalnet/commands/ciaoruozi.py @@ -0,0 +1,16 @@ +from ..utils import Command, CommandArgs, Call +from telegram import Update, User + + +class CiaoruoziCommand(Command): + + command_name = "ciaoruozi" + command_title = "Saluta Ruozi, anche se non è più in RYG." + + async def telegram(self, call: Call, args: CommandArgs): + update: Update = args.kwargs["update"] + user: User = update.effective_user + if user.id == 112437036: + await call.reply("Ciao me!") + else: + await call.reply("Ciao Ruozi!")