0

I am trying to make a command that creates a text channel. I tried to look for a solution but it wouldnt work.

Here is the code I have

@client.command()
async def create(ctx):
  guild = 841035735011819541
  await guild.create_text_channel('test')

2 Answers 2

1

guild is an integer, integer do not have the create_text_channel method. You want to get a discord.Guild instance which has the create_text_channel method

@client.command()
async def create(ctx):
    guild_id = 841035735011819541
    guild = client.get_guild(guild_id)
    await guild.create_text_channel('test')
Sign up to request clarification or add additional context in comments.

Comments

0

Try this.

@client.command()
async def create(ctx):
    guild = ctx.message.guild
    await guild.create_text_channel('cool-channel')

#200th answer! reference

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.