Update server_commands.py

This commit is contained in:
Elmon11 2020-12-08 23:42:29 +01:00 committed by GitHub
parent 067ef84d11
commit 081e6491f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@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)
if eventhostrole in user.roles: if eventhostrole in user.roles:
await user.remove_roles(eventhostrole) await user.remove_roles(eventhostrole)
@ -28,7 +28,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_creative_designer() @is_creative_designer()
async def masterbuilder(self, ctx, user: discord.Member): async def masterbuilder(self, ctx, user: discord.Member):
"""Add or remove master builder role - ECD only""" """Add or remove master builder role - ECD only."""
master_builder_role = ctx.guild.get_role(master_builder) master_builder_role = ctx.guild.get_role(master_builder)
if master_builder_role in user.roles: if master_builder_role in user.roles:
await user.remove_roles(master_builder_role) await user.remove_roles(master_builder_role)
@ -40,7 +40,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@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)
if serverbannedrole in user.roles: if serverbannedrole in user.roles:
await user.remove_roles(serverbannedrole) await user.remove_roles(serverbannedrole)
@ -52,7 +52,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_staff() @is_staff()
async def start(self, ctx): async def start(self, ctx):
"""Starts the server""" """Starts the server."""
em = discord.Embed() em = discord.Embed()
try: try:
attempt = hit_endpoint('start') attempt = hit_endpoint('start')
@ -76,7 +76,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
async def uptime(self, ctx): async def uptime(self, ctx):
"""Returns the uptime of the VPS""" """Returns the uptime of the VPS."""
em = discord.Embed() em = discord.Embed()
em.title = 'VPS Uptime Information' em.title = 'VPS Uptime Information'
em.description = hit_endpoint('uptime') em.description = hit_endpoint('uptime')
@ -85,7 +85,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_staff() @is_staff()
async def stop(self, ctx): async def stop(self, ctx):
"""Stops the server""" """Stops the server."""
em = discord.Embed() em = discord.Embed()
try: try:
attempt = hit_endpoint('stop') attempt = hit_endpoint('stop')
@ -110,7 +110,7 @@ class ServerCommands(commands.Cog):
@commands.command(aliases=['adminconsole', 'ac']) @commands.command(aliases=['adminconsole', 'ac'])
@is_staff() @is_staff()
async def telnet(self, ctx, *args): async def telnet(self, ctx, *args):
"""mv, gtfo, kick, mute or warn from discord""" """mv, gtfo, kick, mute or warn from discord."""
em = discord.Embed() em = discord.Embed()
command = '' command = ''
for arg in args: for arg in args:
@ -141,7 +141,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_senior() @is_senior()
async def kill(self, ctx): async def kill(self, ctx):
"""Kills the server""" """Kills the server."""
em = discord.Embed() em = discord.Embed()
try: try:
attempt = hit_endpoint('kill') attempt = hit_endpoint('kill')
@ -167,7 +167,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_staff() @is_staff()
async def restart(self, ctx): async def restart(self, ctx):
"""Restarts the server""" """Restarts the server."""
em = discord.Embed() em = discord.Embed()
try: try:
self.bot.telnet_object.session.write( self.bot.telnet_object.session.write(
@ -187,7 +187,7 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
@is_senior() @is_senior()
async def console(self, ctx, *, command): async def console(self, ctx, *, command):
"""Send a command as console""" """Send a command as console."""
em = discord.Embed() em = discord.Embed()
try: try:
self.bot.telnet_object.session.write( self.bot.telnet_object.session.write(
@ -205,7 +205,7 @@ class ServerCommands(commands.Cog):
@commands.command(aliases=['status']) @commands.command(aliases=['status'])
async def state(self, ctx): async def state(self, ctx):
"""Gets the current status of the Server""" ."""Gets the current status of the Server."""
em = discord.Embed() em = discord.Embed()
if get_server_status(): if get_server_status():
em.description = 'Server is online' em.description = 'Server is online'
@ -270,14 +270,14 @@ class ServerCommands(commands.Cog):
@commands.command() @commands.command()
async def ip(self, ctx): async def ip(self, ctx):
"""Returns the server IP""" """Returns the server IP."""
await ctx.send(embed=discord.Embed(description='play.totalfreedom.me', title='Server IP')) await ctx.send(embed=discord.Embed(description='play.totalfreedom.me', title='Server IP'))
# pass #discordSRV responds already. # pass #discordSRV responds already.
@commands.command() @commands.command()
@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
reports_channel = self.bot.get_channel(reports_channel_id) reports_channel = self.bot.get_channel(reports_channel_id)
archived_reports_channel = self.bot.get_channel( archived_reports_channel = self.bot.get_channel(
@ -298,7 +298,7 @@ class ServerCommands(commands.Cog):
@commands.command(aliases=['lag', 'gc']) @commands.command(aliases=['lag', 'gc'])
async def tps(self, ctx): async def tps(self, ctx):
"""Lag information regarding the server""" """Lag information regarding the server."""
em = discord.Embed() em = discord.Embed()
em.title = 'Server lag information' em.title = 'Server lag information'
if get_server_status(): if get_server_status():