fix (core init): Handle preload with no members.
Fixes an issue where bot would crash when loaded with no active members.
This commit is contained in:
@@ -46,6 +46,7 @@ async def preload_guild_configuration(client):
|
||||
Loads the plain guild configuration for all guilds the client is part of into data.
|
||||
"""
|
||||
guildids = [guild.id for guild in client.guilds]
|
||||
if guildids:
|
||||
rows = client.data.guild_config.fetch_rows_where(guildid=guildids)
|
||||
client.log(
|
||||
"Preloaded guild configuration for {} guilds.".format(len(rows)),
|
||||
@@ -59,6 +60,7 @@ async def preload_studying_members(client):
|
||||
Loads the member data for all members who are currently in voice channels.
|
||||
"""
|
||||
userids = list(set(member.id for guild in client.guilds for ch in guild.voice_channels for member in ch.members))
|
||||
if userids:
|
||||
rows = client.data.lions.fetch_rows_where(userid=userids)
|
||||
client.log(
|
||||
"Preloaded member data for {} members.".format(len(rows)),
|
||||
|
||||
Reference in New Issue
Block a user