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')
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')
Try this.
@client.command()
async def create(ctx):
guild = ctx.message.guild
await guild.create_text_channel('cool-channel')
#200th answer! reference