Add appropriate checks

pull/154/head
bobloy 4 years ago
parent 5f58d1d658
commit 6e2c62d897

@ -10,7 +10,7 @@ from chatterbot import ChatBot
from chatterbot.comparisons import JaccardSimilarity, LevenshteinDistance, SpacySimilarity from chatterbot.comparisons import JaccardSimilarity, LevenshteinDistance, SpacySimilarity
from chatterbot.response_selection import get_random_response from chatterbot.response_selection import get_random_response
from chatterbot.trainers import ChatterBotCorpusTrainer, ListTrainer, UbuntuCorpusTrainer from chatterbot.trainers import ChatterBotCorpusTrainer, ListTrainer, UbuntuCorpusTrainer
from redbot.core import Config, commands from redbot.core import Config, checks, commands
from redbot.core.commands import Cog from redbot.core.commands import Cog
from redbot.core.data_manager import cog_data_path from redbot.core.data_manager import cog_data_path
from redbot.core.utils.predicates import MessagePredicate from redbot.core.utils.predicates import MessagePredicate
@ -191,6 +191,7 @@ class Chatter(Cog):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
pass pass
@checks.admin()
@chatter.command(name="channel") @chatter.command(name="channel")
async def chatter_channel( async def chatter_channel(
self, ctx: commands.Context, channel: Optional[discord.TextChannel] = None self, ctx: commands.Context, channel: Optional[discord.TextChannel] = None
@ -210,6 +211,7 @@ class Chatter(Cog):
await self.config.guild(ctx.guild).chatchannel.set(channel.id) await self.config.guild(ctx.guild).chatchannel.set(channel.id)
await ctx.maybe_send_embed(f"Chat channel is now {channel.mention}") await ctx.maybe_send_embed(f"Chat channel is now {channel.mention}")
@checks.is_owner()
@chatter.command(name="cleardata") @chatter.command(name="cleardata")
async def chatter_cleardata(self, ctx: commands.Context, confirm: bool = False): async def chatter_cleardata(self, ctx: commands.Context, confirm: bool = False):
""" """
@ -242,6 +244,7 @@ class Chatter(Cog):
await ctx.tick() await ctx.tick()
@checks.is_owner()
@chatter.command(name="algorithm", aliases=["algo"]) @chatter.command(name="algorithm", aliases=["algo"])
async def chatter_algorithm( async def chatter_algorithm(
self, ctx: commands.Context, algo_number: int, threshold: float = None self, ctx: commands.Context, algo_number: int, threshold: float = None
@ -275,6 +278,7 @@ class Chatter(Cog):
await ctx.tick() await ctx.tick()
@checks.is_owner()
@chatter.command(name="model") @chatter.command(name="model")
async def chatter_model(self, ctx: commands.Context, model_number: int): async def chatter_model(self, ctx: commands.Context, model_number: int):
""" """
@ -312,6 +316,7 @@ class Chatter(Cog):
f"Model has been switched to {self.tagger_language.ISO_639_1}" f"Model has been switched to {self.tagger_language.ISO_639_1}"
) )
@checks.is_owner()
@chatter.command(name="minutes") @chatter.command(name="minutes")
async def minutes(self, ctx: commands.Context, minutes: int): async def minutes(self, ctx: commands.Context, minutes: int):
""" """
@ -327,6 +332,7 @@ class Chatter(Cog):
await ctx.tick() await ctx.tick()
@checks.is_owner()
@chatter.command(name="age") @chatter.command(name="age")
async def age(self, ctx: commands.Context, days: int): async def age(self, ctx: commands.Context, days: int):
""" """
@ -341,6 +347,7 @@ class Chatter(Cog):
await self.config.guild(ctx.guild).days.set(days) await self.config.guild(ctx.guild).days.set(days)
await ctx.tick() await ctx.tick()
@checks.is_owner()
@chatter.command(name="backup") @chatter.command(name="backup")
async def backup(self, ctx, backupname): async def backup(self, ctx, backupname):
""" """
@ -362,6 +369,7 @@ class Chatter(Cog):
else: else:
await ctx.maybe_send_embed("Error occurred :(") await ctx.maybe_send_embed("Error occurred :(")
@checks.is_owner()
@chatter.command(name="trainubuntu") @chatter.command(name="trainubuntu")
async def chatter_train_ubuntu(self, ctx: commands.Context, confirmation: bool = False): async def chatter_train_ubuntu(self, ctx: commands.Context, confirmation: bool = False):
""" """
@ -383,6 +391,7 @@ class Chatter(Cog):
else: else:
await ctx.send("Error occurred :(") await ctx.send("Error occurred :(")
@checks.is_owner()
@chatter.command(name="trainenglish") @chatter.command(name="trainenglish")
async def chatter_train_english(self, ctx: commands.Context): async def chatter_train_english(self, ctx: commands.Context):
""" """
@ -396,6 +405,7 @@ class Chatter(Cog):
else: else:
await ctx.maybe_send_embed("Error occurred :(") await ctx.maybe_send_embed("Error occurred :(")
@checks.is_owner()
@chatter.command() @chatter.command()
async def train(self, ctx: commands.Context, channel: discord.TextChannel): async def train(self, ctx: commands.Context, channel: discord.TextChannel):
""" """

Loading…
Cancel
Save