Answer the question
In order to leave comments, you need to log in
Gives an error message. How to pass a guild value to create a channel?
async def func():
conn = sqlite3.connect("timings.db")
c = conn.cursor()
s = c.execute("""SELECT sid FROM requests ORDER BY month,day,hour,minute""")
sid = s.fetchone() # вывод id сервера из базы данных
sid = sid[0] # вывод значения из кортежа
id = sid # для удобства
guild = Bot.get_guild(id) # получение названия сервера
await guild.create_voice_channel("aboba", overwrites=None, category='Classrooms', reason='From command')
c.execute("""DELETE month, day, hour, minute, sid, cid FROM requests ORDER BY month,day,hour,minute""")
conn.commit()
conn.close()
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\79324\Desktop\project\1.py", line 48, in func
await guild.create_voice_channel("aboba", overwrites=None, category='Classrooms', reason='From command')
File "C:\Users\79324\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\guild.py", line 987, in create_voice_channel
data = await self._create_channel(name, overwrites, ChannelType.voice, category, reason=reason, **options)
File "C:\Users\79324\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\guild.py", line 866, in _create_channel
parent_id = category.id if category else None
AttributeError: 'str' object has no attribute 'id'
Answer the question
In order to leave comments, you need to log in
The category parameter must be an instance of the CategoryChannel class, not a string.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question