|
|
|
@ -1,18 +1,22 @@
|
|
|
|
|
import asyncio
|
|
|
|
|
import logging
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
import redis.asyncio as aioredis
|
|
|
|
|
import logging
|
|
|
|
|
from aiogram import Bot, Dispatcher
|
|
|
|
|
from aiogram.types import Message
|
|
|
|
|
from aiogram.utils import executor
|
|
|
|
|
import dotenv
|
|
|
|
|
|
|
|
|
|
from e621 import E621
|
|
|
|
|
|
|
|
|
|
dotenv.load_dotenv('.env')
|
|
|
|
|
|
|
|
|
|
redis = aioredis.from_url('redis://localhost')
|
|
|
|
|
e621 = E621()
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
bot = Bot(token='450146961:AAFqwPcXuWXaYP8j8sE_rYgp_dAsk9YWf7I')
|
|
|
|
|
bot = Bot(token=os.environ['BOT_TOKEN'])
|
|
|
|
|
dp = Dispatcher(bot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,14 +38,14 @@ async def check_updates():
|
|
|
|
|
f'Character: {" ".join(post.tags.character)}\n\n' \
|
|
|
|
|
f'https://e621.net/posts/{post.id}'
|
|
|
|
|
if post.file.ext == 'webm':
|
|
|
|
|
await bot.send_video(98934915,
|
|
|
|
|
await bot.send_video(int(os.environ['SEND_CHAT']),
|
|
|
|
|
post.file.url,
|
|
|
|
|
width=post.file.width,
|
|
|
|
|
height=post.file.height,
|
|
|
|
|
thumb=post.preview.url,
|
|
|
|
|
caption=caption)
|
|
|
|
|
else:
|
|
|
|
|
await bot.send_photo(98934915,
|
|
|
|
|
await bot.send_photo(int(os.environ['SEND_CHAT']),
|
|
|
|
|
post.file.url,
|
|
|
|
|
caption=caption)
|
|
|
|
|
await redis.sadd('e621:sent', post.id)
|
|
|
|
|