Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script gerador da foto oficial da Python Brasil 2020
import asyncio
import sys
from pathlib import Path
import discord
from PIL import Image
def gerar_imagem():
imagens = [, 100), Image.ANTIALIAS)
for foto in Path("fotos").iterdir()
imagem_final ="RGB", (4800, 2800))
for x in range(0, 48):
for y in range(0, 28):
imagem_final.paste(imagens[(48 * y + x) % len(imagens)], (x * 100, y * 100))"python-brasil-2020.jpg")
async def salvar_imagem(member):
if member.default_avatar_url == member.avatar_url:
path = f"fotos/{}.webp"
with open(path, "wb") as fp:
return path
async def main():
token = "Token do bot no Discord"
guild = "ID do servidor da Python Brasil"
client = discord.Client(intents=discord.Intents.all())
await client.login(token)
guild = await client.fetch_guild(guild)
members = await guild.fetch_members().flatten()
tarefas = [salvar_imagem(membro) for membro in membros]
# await asyncio.gather(*tarefas)
await client.close()
print("Imagens salvas")
print("Imagem final gerada")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment