mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 20:47:44 +00:00
WIP Cleaning up the code base + impl slash commands
This commit is contained in:
+9
-16
@@ -1,33 +1,26 @@
|
||||
from discord.ext import commands
|
||||
from utils.database import AutoJoin
|
||||
import discord
|
||||
from utils.EmbedGenerator import EmbedGenerator
|
||||
from bot import ChristmasBot
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
class SettingsCog(commands.Cog, name="Settings"):
|
||||
def __init__(self, bot):
|
||||
def __init__(self, bot: ChristmasBot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command(name='placeholder', hidden=True)
|
||||
@commands.is_owner()
|
||||
async def placeholder(self, ctx):
|
||||
"""Placeholder Command"""
|
||||
|
||||
await ctx.send("Pong!")
|
||||
|
||||
@commands.group(aliases=["aj"], invoke_without_command=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin(self, ctx):
|
||||
async def autojoin(self, ctx: Context):
|
||||
await EmbedGenerator.Message(
|
||||
ctx, "Autojoin",
|
||||
f"Usage:\n\n`{ctx.prefix}autojoin set`\n`{ctx.prefix}autojoin unset`"
|
||||
ctx,
|
||||
"Autojoin",
|
||||
f"Usage:\n\n`{ctx.prefix}autojoin set`\n`{ctx.prefix}autojoin unset`",
|
||||
)
|
||||
|
||||
@autojoin.command(name="set")
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin_set(self, ctx):
|
||||
async def autojoin_set(self, ctx: Context):
|
||||
vc = ctx.author.voice.channel
|
||||
await AutoJoin.update_channel(self.bot, ctx.guild.id, vc.id)
|
||||
await EmbedGenerator.Message(ctx, "Autojoin", "`enabled`")
|
||||
@@ -35,11 +28,11 @@ class SettingsCog(commands.Cog, name="Settings"):
|
||||
@autojoin.command(name="unset")
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||
async def autojoin_del(self, ctx):
|
||||
async def autojoin_del(self, ctx: Context):
|
||||
vc = ctx.author.voice.channel
|
||||
await AutoJoin.del_channel(self.bot, ctx.guild.id)
|
||||
await EmbedGenerator.Message(ctx, "Autojoin", "`disabled`")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
def setup(bot: ChristmasBot):
|
||||
bot.add_cog(SettingsCog(bot))
|
||||
|
||||
Reference in New Issue
Block a user