|
|
@ -5,12 +5,15 @@ logging.basicConfig( |
|
|
|
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s', |
|
|
|
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s', |
|
|
|
level=logging.DEBUG if DEBUG else logging.INFO) |
|
|
|
level=logging.DEBUG if DEBUG else logging.INFO) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import asyncio |
|
|
|
import requests |
|
|
|
import requests |
|
|
|
import random |
|
|
|
import random |
|
|
|
import json |
|
|
|
import json |
|
|
|
import base64 |
|
|
|
import base64 |
|
|
|
import time |
|
|
|
import time |
|
|
|
import re |
|
|
|
import re |
|
|
|
|
|
|
|
from PIL import Image |
|
|
|
|
|
|
|
from datetime import datetime, timezone, timedelta |
|
|
|
from io import BytesIO |
|
|
|
from io import BytesIO |
|
|
|
from telethon import TelegramClient, events |
|
|
|
from telethon import TelegramClient, events |
|
|
|
|
|
|
|
|
|
|
@ -18,6 +21,10 @@ import secrets |
|
|
|
|
|
|
|
|
|
|
|
PROTOSPACE = -1001298858490 |
|
|
|
PROTOSPACE = -1001298858490 |
|
|
|
JASON = 172033414 |
|
|
|
JASON = 172033414 |
|
|
|
|
|
|
|
TANNER = 79316791 |
|
|
|
|
|
|
|
TANNERBOT_MICROSCOPY = -1001886549266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope_subject = '' |
|
|
|
|
|
|
|
|
|
|
|
client = TelegramClient('data/dreamer.session', secrets.TG_API_ID, secrets.TG_API_HASH) |
|
|
|
client = TelegramClient('data/dreamer.session', secrets.TG_API_ID, secrets.TG_API_HASH) |
|
|
|
|
|
|
|
|
|
|
@ -56,6 +63,8 @@ def dreamer(prompt, steps=30, seed=1234, height=512, width=512): |
|
|
|
return None |
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
async def message_handler(event): |
|
|
|
async def message_handler(event): |
|
|
|
|
|
|
|
global scope_subject |
|
|
|
|
|
|
|
|
|
|
|
text = event.raw_text |
|
|
|
text = event.raw_text |
|
|
|
chat = event.chat_id |
|
|
|
chat = event.chat_id |
|
|
|
|
|
|
|
|
|
|
@ -90,6 +99,33 @@ async def message_handler(event): |
|
|
|
|
|
|
|
|
|
|
|
command = command.lower() |
|
|
|
command = command.lower() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#!setscope |
|
|
|
|
|
|
|
if command == 'setscope' and data: |
|
|
|
|
|
|
|
if not reply and sender.id != TANNER: |
|
|
|
|
|
|
|
reply = '> do !scope to look under the microscope' |
|
|
|
|
|
|
|
await event.reply(reply) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not reply: |
|
|
|
|
|
|
|
scope_subject = data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
now = datetime.now(tz=timezone.utc) - timedelta(seconds=1) |
|
|
|
|
|
|
|
reply = '> ' + scope_subject |
|
|
|
|
|
|
|
reply_file = 'frames/' + now.strftime('image%S.jpg') |
|
|
|
|
|
|
|
reply_msg = await event.reply(reply, file=reply_file, link_preview=False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await reply_msg.forward_to(TANNERBOT_MICROSCOPY) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#!scope |
|
|
|
|
|
|
|
if command == 'scope': |
|
|
|
|
|
|
|
logging.info('Chat: {:<14} | ID: {:<6} | User: {} {} | Command: {} | Data: {}'.format(chat, event.id, name, sender.id, command, data or 'None')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not reply: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
now = datetime.now(tz=timezone.utc) - timedelta(seconds=1) |
|
|
|
|
|
|
|
reply = '> ' + scope_subject |
|
|
|
|
|
|
|
reply_file = 'frames/' + now.strftime('image%S.jpg') |
|
|
|
|
|
|
|
reply_msg = await event.reply(reply, file=reply_file, link_preview=False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#!dream |
|
|
|
#!dream |
|
|
|
if command == 'dream': |
|
|
|
if command == 'dream': |
|
|
|