Merge branch 'dev' into fix_wlinfo

This commit is contained in:
2021-11-06 21:38:29 +01:00
committed by GitHub
18 changed files with 506 additions and 196 deletions
+21 -25
View File
@@ -1,24 +1,25 @@
import datetime
import time
from typing import Optional
import discord
from discord.ext import tasks, commands
import time
from discord.ext.commands import Context
import humanize
import datetime
import lavalink
from bot import ChristmasBot
from discord.ext import commands
from discord.ext import tasks
from discord.ext.commands import Context
from bot import TuneBot
from context import CustomContext
from utils.database import AutoJoin
from utils.EmbedGenerator import EmbedGenerator
from utils.classes import BaseCog
from utils.paginator import HelpPaginator
class InformationCog(commands.Cog, name="Information"):
def __init__(self, bot: ChristmasBot):
self.bot = bot
class InformationCog(BaseCog, name="Information"):
@commands.command(name="ping", aliases=["pong"])
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
@commands.command(description="PONG!", aliases=["pong"])
async def ping(self, ctx: Context):
"""Test the latency"""
avatar = ctx.author.avatar.with_static_format("jpeg")
@@ -39,24 +40,18 @@ class InformationCog(commands.Cog, name="Information"):
embed.set_footer(text=f"Requested by: {ctx.author}", icon_url=f"{avatar}")
await msg.edit(embed=embed)
@commands.command(
name="invite", description="Gets the invite link!", slash_commands=True
)
@commands.command(name="invite")
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
async def invite(self, ctx: Context):
"""Gets the invite link!"""
"""Gets the invite link"""
await EmbedGenerator.Message(
ctx, "Add our bot to your server:", self.bot.invite_link
)
@commands.command(
name="wlinfo",
description="Retrieve various Node/Server/Player information.",
slash_commands=True,
)
@commands.command(name="wlinfo")
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
async def wlinfo(self, ctx: Context):
"""Retrieve various Node/Server/Player information."""
async def wlinfo(self, ctx: CustomContext):
"""Retrieve various node/server/player information"""
player = self.bot.lavalink.player_manager.get(ctx.guild.id)
nodes = self.bot.lavalink.node_manager.available_nodes
@@ -77,8 +72,9 @@ class InformationCog(commands.Cog, name="Information"):
#f"Server Uptime: `{datetime.timedelta(milliseconds=node.stats.uptime)}`"
)
await ctx.send(fmt)
AutoJoin.get_channels()
@commands.command(name="help", aliases=["about", "info"], slash_command=True)
@commands.command(name="help", aliases=["about", "info"])
@commands.cooldown(1, 1, commands.BucketType.user)
async def about(
self,
@@ -87,7 +83,7 @@ class InformationCog(commands.Cog, name="Information"):
description="Show help for a command or category"
),
):
"""ChristmasBot command list"""
"""Retrieve a list of possible commands"""
if command:
entity = self.bot.get_cog(command) or self.bot.get_command(command)
@@ -127,6 +123,6 @@ class InformationCog(commands.Cog, name="Information"):
await ctx.send(embed=embed)
def setup(bot: ChristmasBot):
def setup(bot: TuneBot):
bot.remove_command("help")
bot.add_cog(InformationCog(bot))