Close #51, fix starboard channel restrictions
This commit is contained in:
parent
9288da2899
commit
7cee33315c
3 changed files with 14 additions and 6 deletions
|
@ -1011,6 +1011,9 @@ class AdminCog(commands.Cog):
|
|||
async def _autopurge_add(
|
||||
self, ctx: SlashContext, channel: TextChannel, delay: int = 30
|
||||
):
|
||||
if not isinstance(channel, TextChannel):
|
||||
await ctx.send("Channel must be a TextChannel", hidden=True)
|
||||
return
|
||||
autopurge = self.db.jarvis.autopurge.find(
|
||||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
)
|
||||
|
|
|
@ -61,7 +61,9 @@ class SettingsCog(commands.Cog):
|
|||
)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def _modlog(self, ctx, channel: TextChannel):
|
||||
await ctx.defer()
|
||||
if not isinstance(channel, TextChannel):
|
||||
await ctx.send("Channel must be a TextChannel", hidden=True)
|
||||
return
|
||||
self.update_settings("modlog", channel.id, ctx.guild.id)
|
||||
await ctx.send(
|
||||
f"Settings applied. New modlog channel is {channel.mention}"
|
||||
|
|
|
@ -68,6 +68,9 @@ class StarboardCog(commands.Cog):
|
|||
hidden=True,
|
||||
)
|
||||
return
|
||||
if not isinstance(target, TextChannel):
|
||||
await ctx.send("Target must be a TextChannel", hidden=True)
|
||||
return
|
||||
exists = self.db.jarvis.starboard.find_one(
|
||||
{"target": target.id, "guild": ctx.guild.id}
|
||||
)
|
||||
|
@ -101,21 +104,21 @@ class StarboardCog(commands.Cog):
|
|||
],
|
||||
)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def _delete(self, ctx, target: TextChannel):
|
||||
async def _delete(self, ctx, channel: TextChannel):
|
||||
deleted = self.db.jarvis.starboard.delete_one(
|
||||
{
|
||||
"target": target.id,
|
||||
"target": channel.id,
|
||||
"guild": ctx.guild.id,
|
||||
}
|
||||
)
|
||||
if deleted:
|
||||
self.db.jarvis.stars.delete_many({"starboard": target.id})
|
||||
self.db.jarvis.stars.delete_many({"starboard": channel.id})
|
||||
await ctx.send(
|
||||
f"Starboard deleted from {target.mention}.", hidden=True
|
||||
f"Starboard deleted from {channel.mention}.", hidden=True
|
||||
)
|
||||
else:
|
||||
await ctx.send(
|
||||
f"Starboard not found in {target.mention}.", hidden=True
|
||||
f"Starboard not found in {channel.mention}.", hidden=True
|
||||
)
|
||||
|
||||
@cog_ext.cog_subcommand(
|
||||
|
|
Loading…
Add table
Reference in a new issue