mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 20:47:44 +00:00
slash command descriptions configurable by config
This commit is contained in:
+10
-17
@@ -10,15 +10,13 @@ import datetime
|
||||
import lavalink
|
||||
from bot import ChristmasBot
|
||||
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 +37,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."""
|
||||
"""Retrieve various node/server/player information"""
|
||||
player = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
node = player.node
|
||||
|
||||
@@ -79,9 +71,10 @@ class InformationCog(commands.Cog, name="Information"):
|
||||
await ctx.send(fmt)
|
||||
|
||||
from utils import database
|
||||
|
||||
database.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,
|
||||
@@ -90,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)
|
||||
|
||||
|
||||
+8
-12
@@ -2,8 +2,6 @@ import asyncio
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
from aioredis.client import Redis
|
||||
|
||||
import discord
|
||||
from discord.channel import TextChannel
|
||||
from discord.ext.commands.context import Context
|
||||
@@ -13,6 +11,7 @@ from lavalink.models import AudioTrack, DefaultPlayer
|
||||
|
||||
from bot import ChristmasBot
|
||||
from utils.EmbedGenerator import EmbedGenerator
|
||||
from utils.classes import BaseCog
|
||||
from utils.database import AutoJoin
|
||||
from context import CustomContext
|
||||
from discord import Embed
|
||||
@@ -69,10 +68,7 @@ class LavalinkVoiceClient(discord.VoiceClient):
|
||||
self.cleanup()
|
||||
|
||||
|
||||
class Music(commands.Cog):
|
||||
def __init__(self, bot: ChristmasBot):
|
||||
self.bot = bot
|
||||
|
||||
class Music(BaseCog):
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
if not hasattr(
|
||||
@@ -96,7 +92,7 @@ class Music(commands.Cog):
|
||||
|
||||
for guild_id, (voicechannel_id, textchannel_id) in redis_result.items():
|
||||
player = self.bot.lavalink.player_manager.create(guild_id)
|
||||
player.store('channel', textchannel_id)
|
||||
player.store("channel", textchannel_id)
|
||||
voice_channel = await self.bot.fetch_channel(voicechannel_id)
|
||||
await voice_channel.connect(cls=LavalinkVoiceClient)
|
||||
if not player.is_playing:
|
||||
@@ -220,7 +216,7 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="connect", aliases=["p", "play", "join"])
|
||||
async def play(self, ctx: CustomContext):
|
||||
"""Starts playing Christmas bangers"""
|
||||
"""Start the radio"""
|
||||
# Get the player for this guild from cache.
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
await self.fill_player_queue(player, self.bot.config["queue_buffer_size"])
|
||||
@@ -232,20 +228,20 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="skip", aliases=["next"])
|
||||
async def skip(self, ctx: Context):
|
||||
"""I heard this song way too often"""
|
||||
"""Skip the current song"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
await player.skip()
|
||||
await ctx.send("Skipped current song")
|
||||
|
||||
@commands.command(name="queue")
|
||||
@commands.command(name="queue", aliases=["q"])
|
||||
async def queue(self, ctx: Context):
|
||||
"""Ghetto queue"""
|
||||
"""Display the current radio queue"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
await EmbedGenerator.Message(ctx, "Queue:", player.queue)
|
||||
|
||||
@commands.command(name="disconnect", aliases=["dc", "stop"])
|
||||
async def disconnect(self, ctx: Context):
|
||||
"""Disconnects ChristmasBot"""
|
||||
"""Disconnects the radio from the channel"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
|
||||
if not player.is_connected:
|
||||
|
||||
+3
-2
@@ -14,11 +14,12 @@ from contextlib import redirect_stdout
|
||||
from discord.ext.commands.context import Context
|
||||
|
||||
from bot import ChristmasBot
|
||||
from utils.classes import BaseCog
|
||||
|
||||
|
||||
class OwnerCog(commands.Cog):
|
||||
class OwnerCog(BaseCog):
|
||||
def __init__(self, bot: ChristmasBot):
|
||||
self.bot = bot
|
||||
super().__init__(bot)
|
||||
self._last_result = None
|
||||
|
||||
@staticmethod
|
||||
|
||||
+8
-7
@@ -1,18 +1,16 @@
|
||||
from context import CustomContext
|
||||
from discord.ext import commands
|
||||
from utils.EmbedGenerator import EmbedGenerator
|
||||
from utils.classes import BaseCog
|
||||
from utils.database import AutoJoin
|
||||
from bot import ChristmasBot
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
class SettingsCog(commands.Cog, name="Settings"):
|
||||
def __init__(self, bot: ChristmasBot):
|
||||
self.bot = bot
|
||||
|
||||
class SettingsCog(BaseCog, name="Settings"):
|
||||
@commands.group(aliases=["aj"], invoke_without_command=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin(self, ctx: CustomContext):
|
||||
"""Enable/Disable the bot automatically joining"""
|
||||
await EmbedGenerator.Message(
|
||||
ctx,
|
||||
"Autojoin",
|
||||
@@ -23,16 +21,19 @@ class SettingsCog(commands.Cog, name="Settings"):
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin_set(self, ctx: CustomContext):
|
||||
"""Enable the bot automatically joining"""
|
||||
voicechannel_id = ctx.author.voice.channel.id
|
||||
textchannel_id = ctx.message.channel.id
|
||||
await AutoJoin.update_channel(ctx.get_redis(), ctx.guild.id, voicechannel_id, textchannel_id)
|
||||
await AutoJoin.update_channel(
|
||||
ctx.get_redis(), ctx.guild.id, voicechannel_id, textchannel_id
|
||||
)
|
||||
await EmbedGenerator.Message(ctx, "Autojoin", "`enabled`")
|
||||
|
||||
@autojoin.command(name="disable")
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin_del(self, ctx: CustomContext):
|
||||
vc = ctx.author.voice.channel
|
||||
"""Disable the bot automatically joining"""
|
||||
await AutoJoin.del_channel(ctx.get_redis(), ctx.guild.id)
|
||||
await EmbedGenerator.Message(ctx, "Autojoin", "`disabled`")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user