Answer the question
In order to leave comments, you need to log in
Discord.py, how to make attachments save and send an image to another channel?
there is a code:
import discord
from discord.ext import commands
import uuid
bot = commands.Bot(command_prefix="*")
@bot.command(pass_context=True)
async def grole(ctx, arg):
username = ctx.message.author
channel = bot.get_channel("") #указываю ид канала на который отправляю текст
await channel.send(arg)
await channel.send(username)
await channel.send('-----------------------------')
Answer the question
In order to leave comments, you need to log in
@bot.command()
async def grole(ctx):
import io
username = ctx.author
channel = bot.get_channel(id=111111111111111111)
for attach in ctx.message.attachments:
imgn = attach.filename
img = io.BytesIO(await attach.read())
await channel.send(file = discord.File(img, imgn))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question