Limit autoreact to TextChannels, closes #40
This commit is contained in:
parent
8a7a2a63ff
commit
8eaba58992
1 changed files with 5 additions and 2 deletions
|
@ -4,7 +4,7 @@ from datetime import datetime
|
||||||
from discord import TextChannel
|
from discord import TextChannel
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.utils import find
|
from discord.utils import find
|
||||||
from discord_slash import cog_ext
|
from discord_slash import SlashContext, cog_ext
|
||||||
from discord_slash.utils.manage_commands import create_option
|
from discord_slash.utils.manage_commands import create_option
|
||||||
|
|
||||||
import jarvis
|
import jarvis
|
||||||
|
@ -35,7 +35,10 @@ class AutoReactCog(commands.Cog):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
async def _autoreact_create(self, ctx, channel: TextChannel):
|
async def _autoreact_create(self, ctx: SlashContext, channel: TextChannel):
|
||||||
|
if not isinstance(channel, TextChannel):
|
||||||
|
await ctx.send("Channel must be a text channel", hidden=True)
|
||||||
|
return
|
||||||
exists = self.db.jarvis.autoreact.find_one(
|
exists = self.db.jarvis.autoreact.find_one(
|
||||||
{"guild": ctx.guild.id, "channel": channel.id}
|
{"guild": ctx.guild.id, "channel": channel.id}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue