Answer the question
In order to leave comments, you need to log in
Why doesn't the bot code work on the server?
I wrote a code that sends a picture with user data to the chat on the discord server. Everything works stably on my computer, but when I transfer the code to a remote linux server, the picture stops being sent to the chat
@client.command(aliases=["card", "usercard", "user_card"])
async def card_user(ctx):
await ctx.send(":Sin:")
# await ctx.channel.purge(limit=1)
img = Image.new('RGBA', (400, 200), '#232529')
url = str(ctx.author.avatar_url)[:-10]
response = requests.get(url, stream=True)
response = Image.open(io.BytesIO(response.content))
response = response.convert('RGBA')
response = response.resize((100, 100), Image.ANTIALIAS)
img.paste(response, (15, 15, 115, 115))
idraw = ImageDraw.Draw(img)
name = ctx.author.name
tag = ctx.author.discriminator
# user = [r.name for r in guild.roles]
# highest = discord.utils.find(lambda role: role in my_roles, reversed(ctx.author.roles))
headline = ImageFont.truetype('arial.ttf', size=20)
undertext = ImageFont.truetype('arial.ttf', size=12)
idraw.text((145, 15), f'{name}#{tag}', font=headline)
idraw.text((145, 50), f'ID: {ctx.author.id}', font=undertext)
path = os.getcwd()
img.save(f'{path}\\user_card.png')
await ctx.send(file=discord.File(fp=f'{path}\\user_card.png'))
os.remove(f'{path}\\user_card.png')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question