Answer the question
In order to leave comments, you need to log in
How to create voice channel by passing server value from database without ctx?
I need to create a voice channel, having a pre-passed server id value. But when I want to get the server name via guild = Bot.get_guild(id) the guild variable is set to None. Is it even possible to create a channel without ctx? Or should I record the name of the server in the database?
async def func():
print('addin...') #индикатор
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 #для удобства
print(id) #индикатор
guild = Bot.get_guild(id) #получение названия сервера
print(guild) #индикатор
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()
await guild.create_voice_channel("aboba", overwrites=None, category='Classrooms', reason='From command')
AttributeError: 'NoneType' object has no attribute 'create_voice_channel'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question