mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2024-12-22 15:44:57 +00:00
Update ServerCommands.py
This commit is contained in:
parent
024e459291
commit
da68497218
1 changed files with 41 additions and 29 deletions
|
@ -18,33 +18,45 @@ def format_list_entry(embed, list, name):
|
||||||
embed.add_field(name="{} ({})".format(name, len(list)), value=", ".join(list), inline=False)
|
embed.add_field(name="{} ({})".format(name, len(list)), value=", ".join(list), inline=False)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
def is_staff(ctx):
|
class no_permission(commands.MissingPermissions):
|
||||||
user = ctx.message.author
|
pass
|
||||||
for role in user.roles:
|
|
||||||
if role.id in [admin, senior_admin]:
|
def is_staff():
|
||||||
return True
|
def predicate(ctx):
|
||||||
return False
|
user = ctx.message.author
|
||||||
|
for role in user.roles:
|
||||||
def is_liaison(ctx):
|
if role.id in [admin, senior_admin]:
|
||||||
user = ctx.message.author
|
return True
|
||||||
for role in user.roles:
|
else:
|
||||||
if role.id == server_liaison:
|
raise no_permission(['IS_STAFF_MEMBER'])
|
||||||
return True
|
return commands.check(predicate)
|
||||||
return False
|
|
||||||
|
def is_liaison():
|
||||||
def is_senior(ctx):
|
def predicate(ctx):
|
||||||
user = ctx.message.author
|
user = ctx.message.author
|
||||||
for role in user.roles:
|
for role in user.roles:
|
||||||
if role.id == senior_admin:
|
if role.id == server_liaison:
|
||||||
return True
|
return True
|
||||||
return False
|
else:
|
||||||
|
raise no_permission(['IS_SERVER_LIAISON'])
|
||||||
|
return commands.check(predicate)
|
||||||
|
|
||||||
|
def is_senior():
|
||||||
|
def predicate(ctx):
|
||||||
|
user = ctx.message.author
|
||||||
|
for role in user.roles:
|
||||||
|
if role.id == senior_admin:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
raise no_permission(['IS_SENIOR_ADMIN'])
|
||||||
|
return commands.check(predicate)
|
||||||
|
|
||||||
class ServerCommands(commands.Cog):
|
class ServerCommands(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_liaison)
|
@is_liaison()
|
||||||
async def eventhost(self, ctx, user: discord.Member):
|
async def eventhost(self, ctx, user: discord.Member):
|
||||||
'Add or remove event host role - liaison only'
|
'Add or remove event host role - liaison only'
|
||||||
eventhostrole = ctx.guild.get_role(event_host)
|
eventhostrole = ctx.guild.get_role(event_host)
|
||||||
|
@ -56,7 +68,7 @@ class ServerCommands(commands.Cog):
|
||||||
await ctx.send(f'```Succesfully added Event Host to {user.name}```')
|
await ctx.send(f'```Succesfully added Event Host to {user.name}```')
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_staff)
|
@is_staff()
|
||||||
async def serverban(self, ctx, user: discord.Member):
|
async def serverban(self, ctx, user: discord.Member):
|
||||||
'Add or remove server banned role'
|
'Add or remove server banned role'
|
||||||
serverbannedrole = ctx.guild.get_role(server_banned)
|
serverbannedrole = ctx.guild.get_role(server_banned)
|
||||||
|
@ -68,38 +80,38 @@ class ServerCommands(commands.Cog):
|
||||||
await ctx.send(f'Added Server Banned role to {user.name}')
|
await ctx.send(f'Added Server Banned role to {user.name}')
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_staff)
|
@is_staff()
|
||||||
async def start(self, ctx):
|
async def start(self, ctx):
|
||||||
'Not currently working'
|
'Not currently working'
|
||||||
startEmbed = discord.Embed(description='start working out fatass')
|
startEmbed = discord.Embed(description='start working out fatass')
|
||||||
await ctx.send(embed=startEmbed)
|
await ctx.send(embed=startEmbed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_staff)
|
@is_staff()
|
||||||
async def stop(self, ctx):
|
async def stop(self, ctx):
|
||||||
'Not currently working'
|
'Not currently working'
|
||||||
stopEmbed = discord.Embed(description='stop being so sus')
|
stopEmbed = discord.Embed(description='stop being so sus')
|
||||||
await ctx.send(embed=stopEmbed)
|
await ctx.send(embed=stopEmbed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_senior)
|
@is_senior()
|
||||||
async def kill(self, ctx):
|
async def kill(self, ctx):
|
||||||
'Not currently working'
|
'Not currently working'
|
||||||
killEmbed = discord.Embed(description='kill youself')
|
killEmbed = discord.Embed(description='kill youself')
|
||||||
await ctx.send(embed=killEmbed)
|
await ctx.send(embed=killEmbed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_staff)
|
@is_staff()
|
||||||
async def restart(self, ctx):
|
async def restart(self, ctx):
|
||||||
'Not currently working'
|
'Not currently working'
|
||||||
restartEmbed = discord.Embed(description='cant restart a dead server idiot')
|
restartEmbed = discord.Embed(description='cant restart a dead server idiot')
|
||||||
await ctx.send(embed=restartEmbed)
|
await ctx.send(embed=restartEmbed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_senior)
|
@is_senior()
|
||||||
async def console(self, ctx,*, command):
|
async def console(self, ctx,*, command):
|
||||||
'Not currently working'
|
'Not currently working'
|
||||||
await ctx.send(f'```:[{str(datetime.datetime.utcnow().replace(microsecond=0))[11:]} INFO]: {ctx.author.name} issued server command: /{command}```')
|
await ctx.send(f'```:[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: {ctx.author.name} issued server command: /{command}```')
|
||||||
|
|
||||||
|
|
||||||
@commands.command(aliases=['status'])
|
@commands.command(aliases=['status'])
|
||||||
|
@ -157,7 +169,7 @@ class ServerCommands(commands.Cog):
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(is_staff)
|
@is_staff()
|
||||||
async def archivereports(self, ctx):
|
async def archivereports(self, ctx):
|
||||||
"""Archive all in-game reports older than 24 hours"""
|
"""Archive all in-game reports older than 24 hours"""
|
||||||
count = 0
|
count = 0
|
||||||
|
|
Loading…
Reference in a new issue