mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Created a basic bot
This commit is contained in:
parent
fb459deff2
commit
e63aaab424
2 changed files with 12 additions and 5 deletions
11
basicbot.py
Normal file
11
basicbot.py
Normal file
|
@ -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()
|
|
@ -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())
|
Loading…
Reference in a new issue