Populate banned user for bot

This commit is contained in:
Jeremy Zhang 2017-05-14 21:34:14 +00:00
parent 2ab18abc11
commit 71ec14a609

View File

@ -275,8 +275,21 @@ class DatabaseInterface(object):
.filter(GuildMembers.guild_id == guild_id) \
.filter(GuildMembers.user_id == usr.id) \
.filter(GuildMembers.active == False).first()
if dbusr:
changed = True
if dbusr:
dbusr.banned = True
else:
dbusr = GuildMembers(
guild_id,
usr.id,
usr.name,
usr.discriminator,
None,
usr.avatar,
False,
True,
"[]"
)
db.session.add(dbusr)
if changed:
session.commit()