Remove discordbot on init

This commit is contained in:
Jeremy Zhang 2018-01-23 19:13:13 +00:00
parent c3a562590a
commit ff42f4195b

View File

@ -78,27 +78,27 @@ class Titan(discord.Client):
self.botsDiscordPw = BotsDiscordPw(self.user.id, config.get("bots-discord-pw-token", None)) self.botsDiscordPw = BotsDiscordPw(self.user.id, config.get("bots-discord-pw-token", None))
await self.postStats() await self.postStats()
if "no-init" not in sys.argv: # if "no-init" not in sys.argv:
for server in self.servers: # for server in self.servers:
await self.database.update_guild(server) # await self.database.update_guild(server)
if server.large: # if server.large:
await self.request_offline_members(server) # await self.request_offline_members(server)
if server.me.server_permissions.ban_members: # if server.me.server_permissions.ban_members:
server_bans = await self.get_bans(server) # server_bans = await self.get_bans(server)
else: # else:
server_bans = [] # server_bans = []
for member in server.members: # for member in server.members:
banned = member.id in [u.id for u in server_bans] # banned = member.id in [u.id for u in server_bans]
await self.database.update_guild_member( # await self.database.update_guild_member(
member, # member,
True, # True,
banned # banned
) # )
await self.database.flag_unactive_guild_members(server.id, server.members) # await self.database.flag_unactive_guild_members(server.id, server.members)
await self.database.flag_unactive_bans(server.id, server_bans) # await self.database.flag_unactive_bans(server.id, server_bans)
await self.database.remove_unused_guilds(self.servers) # await self.database.remove_unused_guilds(self.servers)
else: # else:
print("Skipping indexing server due to no-init flag") # print("Skipping indexing server due to no-init flag")
async def on_message(self, message): async def on_message(self, message):
await self.database.push_message(message) await self.database.push_message(message)