Use environment variables for credentials
This commit is contained in:
parent
906c539c63
commit
afa5772631
@ -4,6 +4,10 @@ This project contains the source code of my ([@ghnou](https://t.me/ghnou)'s) use
|
||||
|
||||
In terms of functionality it will be not too dissimilar from Konata ([bot](https://t.me/konatasanbot), [source](https://git.ghnou.su/ghnou/konata)). Currently it is still a work in progress.
|
||||
|
||||
#### Credentials
|
||||
|
||||
Visit [my.telegram.org](https://my.telegram.org/apps) to get your API ID and API hash values. These should then be passed into the system as environment variables `api_id` and `api_hash` respectively. A good place to put these would be the system's `/etc/environment` file.
|
||||
|
||||
#### License
|
||||
|
||||
This project is released as "All rights reserved". You are allowed to study the code as inspiration to make your own userbot, but you are not allowed to copy it verbatim.
|
||||
|
5
ubot.py
5
ubot.py
@ -1,10 +1,11 @@
|
||||
import os
|
||||
from telethon import TelegramClient, events
|
||||
from telethon.tl.custom import Dialog
|
||||
from telethon.tl.types import Channel, User, Chat
|
||||
|
||||
# Use your own values from my.telegram.org
|
||||
api_id = 1234567
|
||||
api_hash = '1234567890abcdef'
|
||||
api_id = os.environ['api_id']
|
||||
api_hash = os.environ['api_hash']
|
||||
client = TelegramClient('ubot', api_id, api_hash)
|
||||
|
||||
@client.on(events.NewMessage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user