34 lines
916 B
Python
34 lines
916 B
Python
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):
|
|
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
|
|
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))
|
|
except ConnectionRefusedError:
|
|
await ctx.send("🔴 The Minecraft Server is offline")
|
|
|
|
|
|
|
|
def setup(client):
|
|
client.add_cog(Cog(client))
|