mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:57:48 +00:00
update settings cog
This commit is contained in:
+11
-8
@@ -1,5 +1,7 @@
|
|||||||
|
from context import CustomContext
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from utils.EmbedGenerator import EmbedGenerator
|
from utils.EmbedGenerator import EmbedGenerator
|
||||||
|
from utils.database import AutoJoin
|
||||||
from bot import ChristmasBot
|
from bot import ChristmasBot
|
||||||
from discord.ext.commands import Context
|
from discord.ext.commands import Context
|
||||||
|
|
||||||
@@ -10,27 +12,28 @@ class SettingsCog(commands.Cog, name="Settings"):
|
|||||||
|
|
||||||
@commands.group(aliases=["aj"], invoke_without_command=True)
|
@commands.group(aliases=["aj"], invoke_without_command=True)
|
||||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||||
async def autojoin(self, ctx: Context):
|
async def autojoin(self, ctx: CustomContext):
|
||||||
await EmbedGenerator.Message(
|
await EmbedGenerator.Message(
|
||||||
ctx,
|
ctx,
|
||||||
"Autojoin",
|
"Autojoin",
|
||||||
f"Usage:\n\n`{ctx.prefix}autojoin set`\n`{ctx.prefix}autojoin unset`",
|
f"Usage:\n\n`{ctx.prefix}autojoin set`\n`{ctx.prefix}autojoin unset`",
|
||||||
)
|
)
|
||||||
|
|
||||||
@autojoin.command(name="set")
|
@autojoin.command(name="enable")
|
||||||
@commands.has_permissions(manage_channels=True)
|
@commands.has_permissions(manage_channels=True)
|
||||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||||
async def autojoin_set(self, ctx: Context):
|
async def autojoin_set(self, ctx: CustomContext):
|
||||||
vc = ctx.author.voice.channel
|
voicechannel_id = ctx.author.voice.channel.id
|
||||||
await AutoJoin.update_channel(self.bot, ctx.guild.id, vc.id)
|
textchannel_id = ctx.message.channel.id
|
||||||
|
await AutoJoin.update_channel(ctx.get_redis(), ctx.guild.id, voicechannel_id, textchannel_id)
|
||||||
await EmbedGenerator.Message(ctx, "Autojoin", "`enabled`")
|
await EmbedGenerator.Message(ctx, "Autojoin", "`enabled`")
|
||||||
|
|
||||||
@autojoin.command(name="unset")
|
@autojoin.command(name="disable")
|
||||||
@commands.has_permissions(manage_channels=True)
|
@commands.has_permissions(manage_channels=True)
|
||||||
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
|
||||||
async def autojoin_del(self, ctx: Context):
|
async def autojoin_del(self, ctx: CustomContext):
|
||||||
vc = ctx.author.voice.channel
|
vc = ctx.author.voice.channel
|
||||||
await AutoJoin.del_channel(self.bot, ctx.guild.id)
|
await AutoJoin.del_channel(ctx.get_redis(), ctx.guild.id)
|
||||||
await EmbedGenerator.Message(ctx, "Autojoin", "`disabled`")
|
await EmbedGenerator.Message(ctx, "Autojoin", "`disabled`")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user