iMaGiikz
iMaGiikz

Reputation: 1

Specific channel message without ID in discord py

I am creating a command with my bot, which makes the bot create a channel and I want it to send a message on that newly created channel, but I haven't found any way for it to send a message without the channel ID.

Suppose me the first message should go on the channel where the command was started, but the second should go on the channel created by the bot, which doesn't happen, and I can't put an id to it because it creates the channel. Thanks in advance.

What I take from the command would be this:

async def avengers(ctx):
    guild = ctx.message.guild
    embed = discord.Embed(title='¿Listos?',  color=discord.Color.purple())
    await ctx.send(embed=embed)
    await guild.create_text_channel('『😈』chat-anticristiano')
    for channel in ctx.guild.channels:
    if str(channel) == '『😈』chat-anticristiano':
        channel = '『😈』chat-anticristiano'
        for channel in ctx.guild.channels:
            await ctx.channel.send('Ready!')

Upvotes: 0

Views: 84

Answers (1)

moinierer3000
moinierer3000

Reputation: 1979

You can specify the channel at creation like this:

new_channel = await ctx.guild.create_text_channel('『😈』chat-anticristiano')
await new_channel.send("Ready!")

Upvotes: 3

Related Questions