Skip to content

Commit

Permalink
guild owner
Browse files Browse the repository at this point in the history
  • Loading branch information
Kivou-2000607 committed Dec 15, 2019
1 parent 5fb44b3 commit 505c5df
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bot/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def saveBotsConfigs():
# loop on configuration helpers attached to the bot
for guild in bot.guild_set.all():
var[guild.guildId] = dict({})
var[guild.guildId]["name"] = guild.guildName
var[guild.guildId]["admin"] = {"name": guild.guildName,
"owner": guild.guildOwnerName,
"owner_id": guild.guildOwnerId}

# manage channels
if guild.manageChannels:
Expand All @@ -49,7 +51,7 @@ def saveBotsConfigs():
var[guild.guildId]["stocks"]["channel"] = guild.stockChannel

# chain
if guild.stockModule:
if guild.chainModule:
var[guild.guildId]["chain"] = {"active": True}
if guild.chainChannel:
var[guild.guildId]["chain"]["channel"] = guild.chainChannel
Expand Down
23 changes: 23 additions & 0 deletions bot/migrations/0013_auto_20191215_1959.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.7 on 2019-12-15 19:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bot', '0012_auto_20191214_1326'),
]

operations = [
migrations.AddField(
model_name='guild',
name='guildOwnerId',
field=models.BigIntegerField(default=0),
),
migrations.AddField(
model_name='guild',
name='guildOwnerName',
field=models.CharField(default='guild_owner', max_length=32),
),
]
2 changes: 2 additions & 0 deletions bot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Guild(models.Model):
configuration = models.ForeignKey(DiscordApp, on_delete=models.CASCADE)
guildId = models.BigIntegerField(default=0)
guildName = models.CharField(default="guild_name", max_length=32)
guildOwnerId = models.BigIntegerField(default=0)
guildOwnerName = models.CharField(default="guild_owner", max_length=32)

# general options
manageChannels = models.BooleanField(default=False)
Expand Down
4 changes: 2 additions & 2 deletions templates/bot/apps.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<h2 class="title">{{app.name}} [{{app.id}}]</h2>
<div class="module">
{% for guildId, guild in app.variables.items %}
<h1>Guild {{guild.name}} [{{guildId}}]</h1>
<h1>Guild {{guild.admin.name}} [{{guildId}}] owned by {{guild.admin.owner}} [{{guild.admin.owner_id}}]</h1>
{% for module, options in guild.items %}
{% if module != "name" %}
{% if module != "admin" %}
<h2>{{module}}</h2>
<p>
{% for k, v in options.items %}
Expand Down

0 comments on commit 505c5df

Please sign in to comment.