Reputation: 35
I have setup the bot asks a couple questions. One of them is about a channel. How do I transform the message.content
into a channel?
Script:
ChannelA = await self.client.wait_for('message', check=lambda message: message.author == ctx.author)
channel = self.client.get_channel(ChannelA.content)
await ChannelA.delete()
#Continues with some more questions
From the ChannelA.content
you get a string but I want if, for example, a person mentions the channel it will use this channel.
Thanks
Upvotes: 0
Views: 109
Reputation: 368
When a channel is mentioned it will return: <#channelID>
and because you can't force it to return the object type of discord.TextChannel, I believe your best bet would to be do something like this:
ChannelA = await self.client.wait_for('message', check=lambda message: message.author == ctx.author)
channel_id = int(ChannelA.content[2:-1])
channel = self.client.get_channel(channel_id)
await channel.delete()
#Continues with some more questions
Upvotes: 1