diff --git a/basicbot.py b/basicbot.py new file mode 100644 index 00000000..7e589d05 --- /dev/null +++ b/basicbot.py @@ -0,0 +1,11 @@ +import asyncio +loop = asyncio.get_event_loop() +import telegram + +b = telegram.Bot("ciao pizza") + +async def print_message(bot, update): + print(update.message.content) + +b.commands["echo"] = print_message +b.run() \ No newline at end of file diff --git a/telegram.py b/telegram.py index 391b1a0f..498f1af8 100644 --- a/telegram.py +++ b/telegram.py @@ -28,7 +28,7 @@ class Bot: def __hash__(self): return hash(self.token) - async def run(self): + def run(self): """Run the bot automatically.""" while True: loop.run_until_complete(self.get_updates()) @@ -368,7 +368,3 @@ class Location: class Venue: def __init__(self, init_dict): raise NotImplementedError("Not yet.") - - -b = Bot(os.environ["royalbottelegram"]) -loop.run_until_complete(b.run()) \ No newline at end of file