app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
<link rel="stylesheet" type="text/css" href="{{ url_for( 'static', filename='style.css', v=1)}}">
import os
from PIL import Image
for i in os.listdir('C:\\Users\\user\\Desktop\\image'):
img=Image.open(i)
img.save(i, format="JPEG", quality=30)
from PIL import Image
import glob
foreground_name = 'BFB_Logo.png'
foreground = Image.open(foreground_name)
foreground = foreground.convert('RGBA')
for file_name in glob.glob('*.jpg'):
print (file_name)
background_name = file_name
background = Image.open(background_name)
x = int((background.size[0] / 2) - (foreground.size[0] / 2))
y = int((background.size[1] / 2) - (foreground.size[1] / 2))
background = background.convert('RGBA')
background.paste(foreground, (x, y), mask = foreground)
background.save('__' + background_name.split('.')[0] + '.jpg','JPEG')
print('Gotovo bla-a')
proxies = {
'http': 'xxx.xx.xxx.xx:xxxx',
'https': 'xxx.xx.xxx.xx:xxxx'
}
proxies = []
for proxy in proxies:
response = requests.get(proxies=proxy)
if response.status_code == requests.codes['ok']:
break
response.text
import vk_api
import random
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
vk = vk_api.VkApi(token="ВАШ ТОКЕН")
vk._auth_token()
vk.get_api()
longpoll = VkBotLongPoll(vk, АЙДИ ГРУППЫ)
def send_msg(peer_id: int, message: str, attachment: str = ""):
return vk.method("messages.send", {**locals(), "random_id": 0})
while True:
try:
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.object.peer_id == event.object.from_id: #Только для лс с группой, чтобы работало в беседе == замените на !=
if event.object.text == "Рандом":
word = "0", "0", "0", "0", 'провода'
choice = random.choice(word)
if choice == "провода":
send_msg(event.obj.peer_id, f'{choice}')
else:
print ("Сообщение не отправлено")
except Exception as e:
print(repr(e))