0
@voice.command()
@commands.has_permissions(administrator=True)
async def setup(self, ctx, member: discord.Member = None ):
    conn = sqlite3.connect('voice.db')
    c = conn.cursor()
    guildID = ctx.guild.id
    id = ctx.author.id
    if ctx.author.id == ctx.guild.owner.id or ctx.author.id == 189887758192476162:
        def check(m):
            return m.author.id == ctx.author.id
        await ctx.channel.send("**You have 60 seconds to answer each question!**")
        await ctx.channel.send(f"**Enter the name of the category you wish to create the channels in:(e.g Voice Channels)**")
        try:
            category = await self.bot.wait_for('message', check=check, timeout = 60.0)
        except asyncio.TimeoutError:
            await ctx.channel.send('Took too long to answer!')
        else:
            new_cat = await ctx.guild.create_category_channel(category.content)
            await ctx.channel.send('**Enter the name of the voice channel: (e.g Join To Create)**')
            try:
                channel = await self.bot.wait_for('message', check=check, timeout = 60.0)
            except asyncio.TimeoutError:
                await ctx.channel.send('Took too long to answer!')
            else:
                try:
                    channel = await ctx.guild.create_voice_channel(channel.content, category=new_cat)
                    c.execute("SELECT * FROM guild WHERE guildID = ? AND ownerID=?", (guildID, id))
                    voice=c.fetchone()
                    if voice is None:
                        c.execute ("INSERT INTO guild VALUES (?, ?, ?, ?)",(guildID,id,channel.id,new_cat.id))
                    else:
                        c.execute ("UPDATE guild SET guildID = ?, ownerID = ?, voiceChannelID = ?, voiceCategoryID = ? WHERE guildID = ?",(guildID,id,channel.id,new_cat.id, guildID))
                    await ctx.channel.send("**You are all setup and ready to go!**")
                except:
                    await ctx.channel.send("You didn't enter the names properly.\nUse `.voice setup` again!")
    else:
        await ctx.channel.send(f"{ctx.author.mention} only the owner of the server can setup the bot!")
    conn.commit()
    conn.close()

Spacing is all correct. It give me the error stated in the title and does not tell me what line the error is on. If anyone could offer some feedback that would be amazing. I just don't know what "id" it could be talking about.

1
  • Why do you have self as a parameter in bot.wait_for()? Commented Oct 18, 2021 at 5:22

1 Answer 1

1

I'm pretty sure it's the ctx.guild.owner.id, in which case is not a proper way to retrieve the guild owner

If you want to find the guild's owner id you should enable intents and use ctx.guild.owner_id from here

Sign up to request clarification or add additional context in comments.

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.