This commit is contained in:
Jeremy Zhang 2017-05-20 01:45:38 +00:00
parent 4be91675ff
commit e59fb35e75
2 changed files with 6 additions and 3 deletions

View File

@ -91,18 +91,20 @@ class Titan(discord.Client):
await self.database.delete_message(message)
async def on_server_join(self, guild):
await asyncio.sleep(1)
if not guild.me.server_permissions.administrator:
self.leave_server(guild)
await self.leave_server(guild)
return
await self.database.update_guild(guild)
for channel in guild.channels:
async for message in self.logs_from(channel, limit=50, reverse=True):
await self.database.push_message(message)
for member in guild.members:
update_guild_member(member, True, False)
await self.database.update_guild_member(member, True, False)
banned = self.get_bans(guild)
for ban in banned:
update_guild_member(ban, False, True)
await self.database.update_guild_member(ban, False, True)
async def on_server_remove(self, guild):
await self.database.remove_guild(guild)

View File

@ -124,6 +124,7 @@ def update_administrate_guild(guild_id):
@user.route("/add-bot/<guild_id>")
@discord_users_only()
def add_bot(guild_id):
session["redirect"] = None
return render_template("add_bot.html.j2", guild_id=guild_id, guild_invite_url=generate_bot_invite_url(guild_id))
def prepare_guild_members_list(members, bans):