move telegram bot to main server

This commit is contained in:
David Todd
2020-01-19 18:57:35 -06:00
parent 6979c88d14
commit 5e6c0196c8
2 changed files with 35 additions and 12 deletions

View File

@@ -11,7 +11,6 @@ import datetime
import sqlite3
import uuid
import os
from telethon.sync import TelegramClient
from .db import Database
class TelethonDatabase(Database):
@@ -29,17 +28,6 @@ class TelethonDatabase(Database):
"""
super(TelethonDatabase, self).__init__(database)
# Load in the API tokens required for a bot
api_id = os.environ.get('telethon_api_id', False)
api_hash = os.environ.get('telethon_api_hash', False)
api_token = os.environ.get('telethon_token', False)
# Create an instance of the Telethon bot
if api_id and api_hash and api_token:
self.bot = TelegramClient('bot', api_id, api_hash).start(bot_token=api_token)
else:
self.bot = False
# Automatically create the table if it doesn't
# already exist in the selected database
self._create_table()