Skip to content

Commit

Permalink
bot commun faction role
Browse files Browse the repository at this point in the history
  • Loading branch information
Kivou-2000607 committed Dec 14, 2019
1 parent 8384c00 commit eb84f20
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bot/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DiscordAppAdmin(admin.ModelAdmin):

class GuildAdmin(admin.ModelAdmin):
list_display = ['__str__']
raw_id_fields = ("verifyKeys", "verifyFactions")
raw_id_fields = ("masterKeys", "verifyFactions")


admin.site.register(Guild, GuildAdmin)
8 changes: 4 additions & 4 deletions bot/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ def saveBotsConfigs():
var[guild.guildId]["verify"] = {"active": True}
if guild.verifyForce:
var[guild.guildId]["verify"]["force"] = True

# loop over yata users to get their keys
if guild.verifyFacsRole:
var[guild.guildId]["verify"]["commun"] = guild.verifyFacsRole
var[guild.guildId]["factions"] = dict({f.tId: f.name for f in guild.verifyFactions.all()})

# loop over yata users to get their keys
if len(guild.verifyKeys.all()):
var[guild.guildId]["keys"] = dict({p.tId: p.key for p in guild.verifyKeys.all()})
if len(guild.masterKeys.all()):
var[guild.guildId]["keys"] = dict({p.tId: p.key for p in guild.masterKeys.all()})

bot.variables = json.dumps(var)
bot.save()
23 changes: 23 additions & 0 deletions bot/migrations/0012_auto_20191214_1326.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.7 on 2019-12-14 13:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bot', '0011_auto_20191212_0002'),
]

operations = [
migrations.RenameField(
model_name='guild',
old_name='verifyKeys',
new_name='masterKeys',
),
migrations.AddField(
model_name='guild',
name='verifyFacsRole',
field=models.CharField(blank=True, default='', max_length=16),
),
]
3 changes: 2 additions & 1 deletion bot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Guild(models.Model):

# general options
manageChannels = models.BooleanField(default=False)
masterKeys = models.ManyToManyField(Player, blank=True)

# stock module
stockModule = models.BooleanField(default=False)
Expand All @@ -40,8 +41,8 @@ class Guild(models.Model):
# verify module
verifyModule = models.BooleanField(default=False)
verifyForce = models.BooleanField(default=False)
verifyKeys = models.ManyToManyField(Player, blank=True)
verifyFactions = models.ManyToManyField(Faction, blank=True)
verifyFacsRole = models.CharField(default="", blank=True, max_length=16)

# verify repository
repoModule = models.BooleanField(default=False)
Expand Down

0 comments on commit eb84f20

Please sign in to comment.