Download app.py from KotVasily/botpy: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/spaces/KotVasily/botpy/resolve/main/app.py
- Command line
-
hf download hf://spaces/KotVasily/botpy/app.py
-
curl -L -o app.py https://huggingface.co/spaces/KotVasily/botpy/resolve/main/app.py
637 Bytes
| import logging | |
| import random | |
| import os | |
| from aiogram import Bot, Dispatcher, executor, types | |
| TOKEN = "7588478727:AAF6E0Z6OYLn2pQ4XrfI91t0UeiM3SvADEA" | |
| bot = Bot(token=TOKEN) | |
| dp = Dispatcher(bot) | |
| logging.basicConfig(level=logging.INFO) | |
| async def cmd_test1(message: types.Message): | |
| meme_files = [f for f in os.listdir('image/') if f.endswith('.jpg')] | |
| random_meme = random.choice(meme_files) | |
| with open(os.path.join('image/', random_meme), 'rb') as photo: | |
| await message.answer_photo(photo=photo) | |
| if __name__ == "__main__": | |
| executor.start_polling(dp, skip_updates=True) | |