Removed some imports + class name change

This commit is contained in:
2020-09-29 21:23:43 +02:00
parent 2c3ee3a5ea
commit 2dff716f6f

View File

@@ -1,33 +1,26 @@
import discord
from discord.ext import commands
#from decorators import help
#from enums.help_categories import Category
#from functions import checks
from mcstatus import MinecraftServer
class Cog(commands.Cog):
class ServerStatus(commands.Cog):
def __init__(self, client):
self.client = client
# Don't allow any commands to work when locked
#def cog_check(self, ctx):
# return not self.client.locked
@commands.command()
async def ping(self, ctx):
#play.worldcraft.us
#81.82.224.207
#25568
#25568 -> Earth
#25567 -> Moon
server = MinecraftServer.lookup("81.82.224.207:25568")
#status = server.status()
try:
latency = server.ping()
await ctx.send("🟢 The Minecraft Server replied in {0} ms".format(latency))
embedVar = discord.Embed(title="", description="", color=0x00ff00)
embedVar.add_field(name="Server1", value="🟢 The Minecraft Server replied in {0} ms".format(latency), inline=False)
await ctx.send(embed=embedVar)
except ConnectionRefusedError:
await ctx.send("🔴 The Minecraft Server is offline")
def setup(client):
client.add_cog(Cog(client))
client.add_cog(ServerStatus(client))