-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from YeetCode-devs/staging/pranayadmn
Migrate to Telethon from Pyrogram, create a basic bot based on Telethon and fix poetry.lock
- Loading branch information
Showing
6 changed files
with
98 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
API_ID=12345 | ||
API_HASH=0123456789abcdef0123456789abcdef | ||
BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from dotenv import load_dotenv | ||
from telethon import TelegramClient, events | ||
from os import getenv | ||
|
||
def main() -> None: | ||
load_dotenv() | ||
|
||
api_id = getenv("API_ID") | ||
api_hash = getenv("API_HASH") | ||
bot_token = getenv("BOT_TOKEN") | ||
|
||
app = TelegramClient('app', api_id, api_hash).start(bot_token=bot_token) | ||
|
||
@app.on(events.NewMessage(incoming=True, pattern='/start')) | ||
async def start(event): | ||
await event.reply("Hello!") | ||
|
||
app.run_until_disconnected() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from Bot import main | ||
|
||
if __name__ == "__main__": | ||
main() |