forked from viveksantayana/geas-bot
This branch will not work.
Purging not possible because data files keep getting overwritten by parallel processes.
This commit is contained in:
parent
1826b9d72b
commit
0f447264ec
@ -6,7 +6,7 @@ from discord_slash import SlashCommand, SlashContext, cog_ext, utils # Slash C
|
|||||||
from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features
|
from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features
|
||||||
import logging
|
import logging
|
||||||
# logger and handler
|
# logger and handler
|
||||||
from bot import configFile, yaml_load, yaml_dump
|
from bot import configFile, yaml_load, yaml_dump, dataFile, lookupFile, gmFile, categoriesFile, unloadCog, cogsDir
|
||||||
|
|
||||||
##### Actions for the bot to take whenever there is a new role deleted.
|
##### Actions for the bot to take whenever there is a new role deleted.
|
||||||
|
|
||||||
@ -17,11 +17,71 @@ class on_guild_role_delete(commands.Cog, name='On Guild Role Delete Events'):
|
|||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_guild_role_delete(self, role):
|
async def on_guild_role_delete(self, role):
|
||||||
conf = yaml_load(configFile)
|
conf = yaml_load(configFile)
|
||||||
|
gms = yaml_load(gmFile)
|
||||||
|
categories = yaml_load(categoriesFile)
|
||||||
|
lookup = yaml_load(lookupFile)
|
||||||
|
data = yaml_load(dataFile)
|
||||||
|
guildStr = str(role.guild.id)
|
||||||
|
rStr = str(role.id)
|
||||||
|
|
||||||
#### Bot will only respond if the role is not a bot-managed role, and the role is an admin role
|
#### Bot will only respond if the role is not a bot-managed role, and the role is an admin role
|
||||||
if role.id in conf[str(role.guild.id)]['roles']['admin']:
|
if role.id in conf[guildStr]['roles']['admin']:
|
||||||
conf[str(role.guild.id)]['roles']['admin'].remove(role.id)
|
conf[guildStr]['roles']['admin'].remove(role.id)
|
||||||
yaml_dump(conf, configFile)
|
yaml_dump(conf, configFile)
|
||||||
|
return
|
||||||
#### If the role is one of the Admin roles and is deleted, updates the bot's config to delete that role, preventing unnecessary roles from accumulating.
|
#### If the role is one of the Admin roles and is deleted, updates the bot's config to delete that role, preventing unnecessary roles from accumulating.
|
||||||
|
|
||||||
|
#### Bot will delete membership type if the membership role is deleted.
|
||||||
|
if role.id in conf[guildStr]['membership']:
|
||||||
|
conf[guildStr]['membership'].remove(role.id)
|
||||||
|
yaml_dump(conf, configFile)
|
||||||
|
if not any([x['membership'] for x in yaml_load(configFile).values()]):
|
||||||
|
unloadCog(f'./{cogsDir}/slashcommands/secondary/edit_membership.py')
|
||||||
|
await self.client.slash.sync_all_commands()
|
||||||
|
return
|
||||||
|
|
||||||
|
#### Synchronising with the Game Creation Process
|
||||||
|
# Whenever a game role is deleted, the Bot will update the guild's configurations and channels to match.
|
||||||
|
if rStr in lookup[guildStr]:
|
||||||
|
game_title = lookup[guildStr][rStr]['game_title']
|
||||||
|
time = lookup[guildStr][rStr]['time']
|
||||||
|
c = role.guild.get_channel(lookup[guildStr][rStr]['category'])
|
||||||
|
gm = await role.guild.fetch_member(lookup[guildStr][rStr]['gm'])
|
||||||
|
del data[guildStr][time][rStr]
|
||||||
|
channelsFound = False
|
||||||
|
if c is not None:
|
||||||
|
channelsFound = True
|
||||||
|
for t in role.guild.text_channels:
|
||||||
|
if t.category == c:
|
||||||
|
await t.delete(reason=f'Role Delete Event Listener: Synchronising with deletion of role `{role.name}`')
|
||||||
|
for v in role.guild.voice_channels:
|
||||||
|
if v.category == c:
|
||||||
|
await v.delete(reason=f'Role Delete Event Listener: Synchronising with deletion of role `{role.name}`')
|
||||||
|
del categories[guildStr][str(c.id)]
|
||||||
|
await c.delete(reason=f'Role Delete Event Listener: Synchronising with deletion of role `{role.name}`')
|
||||||
|
lookup[guildStr].pop(rStr, None)
|
||||||
|
output = f'The game `{game_title}` for timeslot `{conf[guildStr]["timeslots"][time]}` and with GM `{gm.display_name}` has been deleted.'
|
||||||
|
if channelsFound:
|
||||||
|
output = ''.join([output,' All associated text, voice, and category channels have been deleted.'])
|
||||||
|
else:
|
||||||
|
output = ''.join([output,' No associated text, voice, or category channels were found. Please delete them manually if they still persist.'])
|
||||||
|
if 'mod' in conf[guildStr]['channels'] and 'committee' in conf[guildStr]['roles']:
|
||||||
|
c = discord.utils.find(lambda x: x.id == conf[guildStr]['channels']['mod'], role.guild.channels)
|
||||||
|
await c.send(
|
||||||
|
content = f'```{output}```'
|
||||||
|
)
|
||||||
|
gms[guildStr][str(gm.id)].remove(role.id)
|
||||||
|
if not gms[guildStr][str(gm.id)]: del gms[guildStr][str(gm.id)]
|
||||||
|
if not data[guildStr][time]: del data[guildStr][time]
|
||||||
|
yaml_dump(lookup, lookupFile)
|
||||||
|
yaml_dump(data, dataFile)
|
||||||
|
yaml_dump(gms, gmFile)
|
||||||
|
yaml_dump(categories, categoriesFile)
|
||||||
|
if not any([x for x in yaml_load(lookupFile).values()]):
|
||||||
|
unloadCog(f'./{cogsDir}/slashcommands/secondary/game_management.py')
|
||||||
|
if self.client.get_cog('Player Commands') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
||||||
|
if self.client.get_cog('Pitch Command') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||||
|
await self.client.slash.sync_all_commands()
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
client.add_cog(on_guild_role_delete(client))
|
client.add_cog(on_guild_role_delete(client))
|
@ -5,8 +5,9 @@ from discord.ext import commands # Commands module
|
|||||||
from discord_slash import SlashCommand, SlashContext, cog_ext, utils # Slash Command Library
|
from discord_slash import SlashCommand, SlashContext, cog_ext, utils # Slash Command Library
|
||||||
from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features
|
from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
# logger and handler
|
# logger and handler
|
||||||
from bot import configFile, yaml_load, yaml_dump
|
from bot import configFile, yaml_load, yaml_dump, gmFile, categoriesFile, lookupFile, dataFile
|
||||||
|
|
||||||
##### Actions for the bot to take whenever there is a new role deleted.
|
##### Actions for the bot to take whenever there is a new role deleted.
|
||||||
|
|
||||||
@ -17,18 +18,56 @@ class on_guild_role_update(commands.Cog, name='On Guild Role Update Events'):
|
|||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_guild_role_update(self, before, after):
|
async def on_guild_role_update(self, before, after):
|
||||||
conf = yaml_load(configFile)
|
conf = yaml_load(configFile)
|
||||||
#### If the original role is in the config as an admin role, and it subsequently is run by a bot or is not an admin, remove it from config
|
gms = yaml_load(gmFile)
|
||||||
|
categories = yaml_load(categoriesFile)
|
||||||
|
lookup = yaml_load(lookupFile)
|
||||||
|
data = yaml_load(dataFile)
|
||||||
|
guildStr = str(after.guild.id)
|
||||||
|
rStr = str(after.id)
|
||||||
|
|
||||||
|
#### If the original role is in the config is an admin role, and it subsequently is run by a bot or is not an admin, remove it from config
|
||||||
if before.id in conf[str(before.guild.id)]['roles']['admin']:
|
if before.id in conf[str(before.guild.id)]['roles']['admin']:
|
||||||
if after.is_bot_managed() or after.is_integration() or not after.permissions.administrator:
|
if after.is_bot_managed() or after.is_integration() or not after.permissions.administrator:
|
||||||
conf[str(after.guild.id)]['roles']['admin'].remove(after.id)
|
conf[str(after.guild.id)]['roles']['admin'].remove(after.id)
|
||||||
yaml_dump(conf, configFile)
|
yaml_dump(conf, configFile)
|
||||||
|
return
|
||||||
|
|
||||||
#### If the new role is an admin and is not already in the config, add it.
|
#### If the new role is an admin and is not already in the config, add it.
|
||||||
if not (after.is_bot_managed() or after.is_integration()) and after.permissions.administrator:
|
if not (after.is_bot_managed() or after.is_integration()) and after.permissions.administrator:
|
||||||
if after.id not in conf[str(after.guild.id)]['roles']['admin']:
|
if after.id not in conf[str(after.guild.id)]['roles']['admin']:
|
||||||
conf[str(after.guild.id)]['roles']['admin'].remove(after.id)
|
conf[str(after.guild.id)]['roles']['admin'].remove(after.id)
|
||||||
yaml_dump(conf, configFile)
|
yaml_dump(conf, configFile)
|
||||||
#### If the role is one of the Admin roles and is deleted, updates the bot's config to delete that role, preventing unnecessary roles from accumulating.
|
#### If the role is one of the Admin roles and is stripped of admin permissions, updates the bot's config to delete that role, preventing unnecessary roles from accumulating.
|
||||||
|
return
|
||||||
|
|
||||||
|
#### If the original role is a game role:
|
||||||
|
if rStr in lookup[guildStr]:
|
||||||
|
|
||||||
|
#### Suppress invalid changes
|
||||||
|
revert = {}
|
||||||
|
# Check name change
|
||||||
|
if before.name != after.name:
|
||||||
|
if ': ' not in after.name: revert['name'] = before.name
|
||||||
|
else:
|
||||||
|
if after.name.split(': ', maxsplit=1)[0].lower() not in conf[guildStr]['timeslots']: revert['name'] = before.name
|
||||||
|
# Check role colour
|
||||||
|
if before.colour != after.colour: revert['colour'] = before.colour
|
||||||
|
# Check role hoist
|
||||||
|
if before.hoist != after.hoist: revert['hoist'] = before.hoist
|
||||||
|
# Check role mentionable
|
||||||
|
if before.mentionable != after.mentionable: revert['mentionable'] = before.mentionable
|
||||||
|
# Check role permissions
|
||||||
|
if before.permissions != after.mentionable: revert['permissions'] = before.permissions
|
||||||
|
#### Suppress changes if the new settings are invalid
|
||||||
|
if revert:
|
||||||
|
revert['reason'] = 'Role Update Event Listener: Suppressing permission change for game role.'
|
||||||
|
await after.edit(**revert)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
client.add_cog(on_guild_role_update(client))
|
client.add_cog(on_guild_role_update(client))
|
@ -119,7 +119,7 @@ class Configuration(commands.Cog, name='Configuration Commands'):
|
|||||||
if self.client.get_cog('Player Commands') is None:
|
if self.client.get_cog('Player Commands') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
||||||
flag = True
|
flag = True
|
||||||
if self.client.get_cog('Pitch') is None:
|
if self.client.get_cog('Pitch Command') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||||
flag = True
|
flag = True
|
||||||
if flag: await self.client.slash.sync_all_commands()
|
if flag: await self.client.slash.sync_all_commands()
|
||||||
@ -297,7 +297,7 @@ class Configuration(commands.Cog, name='Configuration Commands'):
|
|||||||
if self.client.get_cog('Player Commands') is None:
|
if self.client.get_cog('Player Commands') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
||||||
Flag = True
|
Flag = True
|
||||||
if self.client.get_cog('Pitch') is None:
|
if self.client.get_cog('Pitch Command') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||||
Flag = True
|
Flag = True
|
||||||
if flag: await self.client.slash.sync_all_commands()
|
if flag: await self.client.slash.sync_all_commands()
|
||||||
|
@ -53,13 +53,9 @@ class EditMembership(commands.Cog, name='Edit Membership'):
|
|||||||
if 'membership' not in conf[str(ctx.guild.id)]:
|
if 'membership' not in conf[str(ctx.guild.id)]:
|
||||||
conf[str(ctx.guild.id)]['timeslots'] = {}
|
conf[str(ctx.guild.id)]['timeslots'] = {}
|
||||||
if role.id in conf[str(ctx.guild.id)]['membership']:
|
if role.id in conf[str(ctx.guild.id)]['membership']:
|
||||||
conf[str(ctx.guild.id)]['membership'].remove(role.id)
|
|
||||||
yaml_dump(conf, configFile)
|
|
||||||
await ctx.send(f'```Membership type {role.name} has been deleted for the guild `{ctx.guild.name}`.```')
|
await ctx.send(f'```Membership type {role.name} has been deleted for the guild `{ctx.guild.name}`.```')
|
||||||
await role.delete(reason=f'`/config membership remove` command issued by `{ctx.author.display_name}`.')
|
await role.delete(reason=f'`/config membership remove` command issued by `{ctx.author.display_name}`.')
|
||||||
if not any([x['membership'] for x in yaml_load(configFile).values()]):
|
#### Bot will delete the membership role. Then the on_guild_role_delete event listener will synchronise the configurations.
|
||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/edit_membership.py')
|
|
||||||
await self.client.slash.sync_all_commands()
|
|
||||||
elif conf[str(ctx.guild.id)]['membership']:
|
elif conf[str(ctx.guild.id)]['membership']:
|
||||||
output = f'Role `{role.name}` is not a registered membership role in the guild `{ctx.guild.name}`. Please select a valid membership role.\n\n Eligible roles are:\n'
|
output = f'Role `{role.name}` is not a registered membership role in the guild `{ctx.guild.name}`. Please select a valid membership role.\n\n Eligible roles are:\n'
|
||||||
for m in conf[str(ctx.guild.id)]['membership']:
|
for m in conf[str(ctx.guild.id)]['membership']:
|
||||||
|
@ -290,7 +290,7 @@ class GameCreate(commands.Cog, name='Game Create'):
|
|||||||
if self.client.get_cog('Player Commands') is None:
|
if self.client.get_cog('Player Commands') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
||||||
flag = True
|
flag = True
|
||||||
if self.client.get_cog('Pitch') is None:
|
if self.client.get_cog('Pitch Command') is None:
|
||||||
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
loadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||||
flag = True
|
flag = True
|
||||||
if flag: await self.client.slash.sync_all_commands()
|
if flag: await self.client.slash.sync_all_commands()
|
||||||
|
@ -17,10 +17,7 @@ class GameManagement(commands.Cog, name='Game Management'):
|
|||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
conf = yaml_load(configFile)
|
|
||||||
lookup = yaml_load(lookupFile)
|
lookup = yaml_load(lookupFile)
|
||||||
data = yaml_load(dataFile)
|
|
||||||
|
|
||||||
guild_ids= [ int(x) for x in list(lookup)]
|
guild_ids= [ int(x) for x in list(lookup)]
|
||||||
|
|
||||||
### Move delete, Modify, and Reset commands to a separate secondary cog to enable when games exist?
|
### Move delete, Modify, and Reset commands to a separate secondary cog to enable when games exist?
|
||||||
@ -63,45 +60,11 @@ class GameManagement(commands.Cog, name='Game Management'):
|
|||||||
return
|
return
|
||||||
game_title = lookup[guildStr][rStr]['game_title']
|
game_title = lookup[guildStr][rStr]['game_title']
|
||||||
time = lookup[guildStr][rStr]['time']
|
time = lookup[guildStr][rStr]['time']
|
||||||
c = ctx.guild.get_channel(lookup[guildStr][rStr]['category'])
|
gm = await ctx.guild.fetch_member(lookup[guildStr][rStr]['gm'])
|
||||||
gm = lookup[guildStr][rStr]['gm']
|
output = f'The game `{game_title}` for timeslot `{conf[guildStr]["timeslots"][time]}` and with GM `{gm.display_name}` has been deleted.'
|
||||||
channelsFound = False
|
await ctx.send(f'```Game `{game_title}` has been deleted.```', hidden=True)
|
||||||
del data[guildStr][time][rStr]
|
|
||||||
if c is not None:
|
|
||||||
channelsFound = True
|
|
||||||
for t in ctx.guild.text_channels:
|
|
||||||
if t.category == c:
|
|
||||||
await t.delete(reason=f'/game delete command issued by `{ctx.author.display_name}`')
|
|
||||||
for v in ctx.guild.voice_channels:
|
|
||||||
if v.category == c:
|
|
||||||
await v.delete(reason=f'/game delete command issued by `{ctx.author.display_name}`')
|
|
||||||
del categories[guildStr][str(c.id)]
|
|
||||||
await c.delete(reason=f'/game delete command issued by `{ctx.author.display_name}`')
|
|
||||||
lookup[guildStr].pop(rStr, None)
|
|
||||||
gm_m = await ctx.guild.fetch_member(gm)
|
|
||||||
output = f'The game `{game_title}` for timeslot `{conf[guildStr]["timeslots"][time]}` and with GM `{gm_m.display_name}` has been deleted.'
|
|
||||||
if channelsFound:
|
|
||||||
output = ''.join([output,' All associated text, voice, and category channels have been deleted.'])
|
|
||||||
else:
|
|
||||||
output = ''.join([output,' No associated text, voice, or category channels were found. Please delete them manually if they still persist.'])
|
|
||||||
if 'mod' in conf[guildStr]['channels'] and 'committee' in conf[guildStr]['roles']:
|
|
||||||
c = discord.utils.find(lambda x: x.id == conf[guildStr]['channels']['mod'], ctx.guild.channels)
|
|
||||||
await c.send(
|
|
||||||
content = f'```{output}```'
|
|
||||||
)
|
|
||||||
await game_role.delete(reason=f'/game delete command issued by `{ctx.author.display_name}`')
|
await game_role.delete(reason=f'/game delete command issued by `{ctx.author.display_name}`')
|
||||||
gms[guildStr][str(gm)].remove(game_role.id)
|
#### Bot will delete the game role. The on_guild_role_delete event listener will then recognise this deletion and synchronise the categories and data files accordingly.
|
||||||
if not gms[guildStr][str(gm)]: del gms[guildStr][str(gm)]
|
|
||||||
if not data[guildStr][time]: del data[guildStr][time]
|
|
||||||
yaml_dump(lookup, lookupFile)
|
|
||||||
yaml_dump(data, dataFile)
|
|
||||||
yaml_dump(gms, gmFile)
|
|
||||||
yaml_dump(categories, categoriesFile)
|
|
||||||
if not any([x for x in yaml_load(lookupFile).values()]):
|
|
||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/game_management.py')
|
|
||||||
if self.client.get_cog('Player Commands') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
|
||||||
if self.client.get_cog('Pitch') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
|
||||||
await self.client.slash.sync_all_commands()
|
|
||||||
|
|
||||||
@cog_ext.cog_subcommand(
|
@cog_ext.cog_subcommand(
|
||||||
base='game',
|
base='game',
|
||||||
@ -197,12 +160,9 @@ class GameManagement(commands.Cog, name='Game Management'):
|
|||||||
rStr = str(r.id)
|
rStr = str(r.id)
|
||||||
old_time = lookup[guildStr][rStr]['time']
|
old_time = lookup[guildStr][rStr]['time']
|
||||||
time = re.sub(r"\W+",'', timeslot[:9].lower()) if timeslot else old_time
|
time = re.sub(r"\W+",'', timeslot[:9].lower()) if timeslot else old_time
|
||||||
if guildStr not in lookup:
|
if guildStr not in lookup: lookup[guildStr] = {}
|
||||||
lookup[guildStr] = {}
|
if guildStr not in data: data[guildStr] = {}
|
||||||
if guildStr not in data:
|
if time not in data[guildStr]: data[guildStr][time] = {}
|
||||||
data[guildStr] = {}
|
|
||||||
if time not in data[guildStr]:
|
|
||||||
data[guildStr][time] = {}
|
|
||||||
# Command Validation Checks
|
# Command Validation Checks
|
||||||
if rStr not in lookup[guildStr]:
|
if rStr not in lookup[guildStr]:
|
||||||
await ctx.send(f'```Error: This is not a valid game role. Please mention a role that is associated with a game.```',hidden=True)
|
await ctx.send(f'```Error: This is not a valid game role. Please mention a role that is associated with a game.```',hidden=True)
|
||||||
@ -416,18 +376,9 @@ class GameManagement(commands.Cog, name='Game Management'):
|
|||||||
|
|
||||||
async def purgeGames(ctx:SlashContext, timeslot:str):
|
async def purgeGames(ctx:SlashContext, timeslot:str):
|
||||||
for g in list(data[guildStr][timeslot].values()):
|
for g in list(data[guildStr][timeslot].values()):
|
||||||
c = discord.utils.find(lambda x: x.id == g['category'], ctx.guild.categories)
|
|
||||||
r = discord.utils.find(lambda x: x.id == g['role'], ctx.guild.roles)
|
r = discord.utils.find(lambda x: x.id == g['role'], ctx.guild.roles)
|
||||||
for x in c.channels:
|
|
||||||
await x.delete(reason=f'/game purge command issued by `{ctx.author.display_name}`')
|
|
||||||
del categories[guildStr][str(c.id)]
|
|
||||||
await c.delete(reason=f'/game purge command issued by `{ctx.author.display_name}`')
|
|
||||||
await r.delete(reason=f'/game purge command issued by `{ctx.author.display_name}`')
|
await r.delete(reason=f'/game purge command issued by `{ctx.author.display_name}`')
|
||||||
gms[guildStr][str(g['gm'])].remove(r.id)
|
#### Bot will delete the game role. The on_guild_role_delete event listener will then recognise this deletion and synchronise the categories and data files accordingly.
|
||||||
if not gms[guildStr][str(g['gm'])]:
|
|
||||||
del gms[guildStr][str(g['gm'])]
|
|
||||||
del lookup[guildStr][str(r.id)]
|
|
||||||
del data[guildStr][timeslot]
|
|
||||||
|
|
||||||
if 'timeslots' not in conf[guildStr]: conf[guildStr]['timeslots'] = {}
|
if 'timeslots' not in conf[guildStr]: conf[guildStr]['timeslots'] = {}
|
||||||
tsDict = {k: conf[guildStr]['timeslots'][k] for k in data[guildStr] if data[guildStr][k]}
|
tsDict = {k: conf[guildStr]['timeslots'][k] for k in data[guildStr] if data[guildStr][k]}
|
||||||
@ -549,15 +500,6 @@ class GameManagement(commands.Cog, name='Game Management'):
|
|||||||
await c.send(
|
await c.send(
|
||||||
content = f'```All games for time slot `{conf[guildStr]["timeslots"][timeslot]}` have been purged.```'
|
content = f'```All games for time slot `{conf[guildStr]["timeslots"][timeslot]}` have been purged.```'
|
||||||
)
|
)
|
||||||
yaml_dump(gms,gmFile)
|
|
||||||
yaml_dump(lookup,lookupFile)
|
|
||||||
yaml_dump(data,dataFile)
|
|
||||||
yaml_dump(categories,categoriesFile)
|
|
||||||
if not any([x for x in yaml_load(lookupFile).values()]):
|
|
||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/game_management.py')
|
|
||||||
if self.client.get_cog('Player Commands') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
|
||||||
if self.client.get_cog('Pitch') is not None: unloadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
|
||||||
await self.client.slash.sync_all_commands()
|
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
client.add_cog(GameManagement(client))
|
client.add_cog(GameManagement(client))
|
@ -97,7 +97,7 @@ class ManipulateTimeslots(commands.Cog, name='Manipulate Timeslots'):
|
|||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/game_create.py')
|
unloadCog(f'./{cogsDir}/slashcommands/secondary/game_create.py')
|
||||||
if self.client.get_cog('Player Commands') is not None:
|
if self.client.get_cog('Player Commands') is not None:
|
||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
unloadCog(f'./{cogsDir}/slashcommands/secondary/player_commands.py')
|
||||||
if self.client.get_cog('Pitch') is not None:
|
if self.client.get_cog('Pitch Command') is not None:
|
||||||
unloadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
unloadCog(f'./{cogsDir}/slashcommands/secondary/pitch.py')
|
||||||
await self.client.slash.sync_all_commands()
|
await self.client.slash.sync_all_commands()
|
||||||
else:
|
else:
|
||||||
|
@ -1 +1,5 @@
|
|||||||
'864651943820525609': {}
|
'864651943820525609':
|
||||||
|
'868432993251885067': 868432992165560360
|
||||||
|
'868436813860184095': 868436812148908112
|
||||||
|
'868437806064750602': 868437804575756288
|
||||||
|
'868437891397849119': 868437889799823441
|
||||||
|
Loading…
Reference in New Issue
Block a user