Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from appwrite.client import Client
- import telebot
- from dotenv import load_dotenv
- import os
- from appwrite.services.databases import Databases
- from appwrite.id import ID
- load_dotenv()
- client = Client()
- db = Databases(client)
- API_KEY = os.environ.get('API_KEY')
- TOKEN = os.environ.get('TOKEN')
- CHAT_ID = os.environ.get('CHAT_ID')
- PROJECT_ID = os.environ.get('PROJECT_ID')
- ENDPOINT = os.environ.get('ENDPOINT')
- (client
- .set_endpoint(f'http://{ENDPOINT}/v1')
- .set_project(PROJECT_ID)
- .set_key(API_KEY)
- .set_self_signed()
- )
- print('CREATED')
- dt = db.list()
- print(dt)
- bot = telebot.TeleBot(TOKEN, parse_mode=None)
- @bot.message_handler(commands=['start', 'help'])
- def send_welcome(message):
- bot.reply_to(message, "Test?")
- @bot.message_handler(content_types=['text'])
- def logging(message):
- payload = {"payload": message.text}
- db.create_document('1', '12345', ID.unique(), payload)
- bot.infinity_polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement