Make error replies hidden
This commit is contained in:
parent
8eaba58992
commit
1e0056f339
8 changed files with 84 additions and 48 deletions
|
@ -74,13 +74,15 @@ class AdminCog(commands.Cog):
|
|||
length: int = 4,
|
||||
):
|
||||
if not user or user == ctx.author:
|
||||
await ctx.send("You cannot ban yourself.")
|
||||
await ctx.send("You cannot ban yourself.", hidden=True)
|
||||
return
|
||||
if user == self.bot.user:
|
||||
await ctx.send("I'm afraid I can't let you do that")
|
||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||
return
|
||||
if type == "temp" and length < 0:
|
||||
await ctx.send("You cannot set a temp ban to < 0 hours.")
|
||||
await ctx.send(
|
||||
"You cannot set a temp ban to < 0 hours.", hidden=True
|
||||
)
|
||||
return
|
||||
if not reason:
|
||||
reason = (
|
||||
|
@ -374,10 +376,10 @@ class AdminCog(commands.Cog):
|
|||
@admin_or_permissions(kick_members=True)
|
||||
async def _kick(self, ctx: SlashContext, user: User, reason=None):
|
||||
if not user or user == ctx.author:
|
||||
await ctx.send("You cannot kick yourself.")
|
||||
await ctx.send("You cannot kick yourself.", hidden=True)
|
||||
return
|
||||
if user == self.bot.user:
|
||||
await ctx.send("I'm afraid I can't let you do that")
|
||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||
return
|
||||
if not reason:
|
||||
reason = (
|
||||
|
@ -421,7 +423,7 @@ class AdminCog(commands.Cog):
|
|||
@admin_or_permissions(manage_messages=True)
|
||||
async def _purge(self, ctx: SlashContext, amount: int = 10):
|
||||
if amount < 1:
|
||||
await ctx.send("Amount must be >= 1")
|
||||
await ctx.send("Amount must be >= 1", hidden=True)
|
||||
return
|
||||
await ctx.defer()
|
||||
channel = ctx.channel
|
||||
|
@ -470,17 +472,18 @@ class AdminCog(commands.Cog):
|
|||
):
|
||||
await ctx.defer()
|
||||
if user == ctx.author:
|
||||
await ctx.send("You cannot mute yourself.")
|
||||
await ctx.send("You cannot mute yourself.", hidden=True)
|
||||
return
|
||||
if user == self.bot.user:
|
||||
await ctx.send("I'm afraid I can't let you do that")
|
||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||
return
|
||||
mute_setting = self.db.jarvis.settings.find_one(
|
||||
{"guild": ctx.guild.id, "setting": "mute"}
|
||||
)
|
||||
if not mute_setting:
|
||||
await ctx.send(
|
||||
"Please configure a mute role with /settings mute <role> first"
|
||||
"Please configure a mute role with /settings mute <role> first",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
role = get(ctx.guild.roles, id=mute_setting["value"])
|
||||
|
@ -535,7 +538,8 @@ class AdminCog(commands.Cog):
|
|||
if not mute_setting:
|
||||
await ctx.send(
|
||||
"Please configure a mute role with "
|
||||
+ "/settings mute <role> first."
|
||||
+ "/settings mute <role> first.",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -543,7 +547,7 @@ class AdminCog(commands.Cog):
|
|||
if role in user.roles:
|
||||
await user.remove_roles(role, reason="Unmute")
|
||||
else:
|
||||
await ctx.send("User is not muted.")
|
||||
await ctx.send("User is not muted.", hidden=True)
|
||||
return
|
||||
|
||||
self.db.jarvis.mutes.update_many(
|
||||
|
@ -663,7 +667,7 @@ class AdminCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "channel": channel.id, "active": True}
|
||||
)
|
||||
if not lock:
|
||||
await ctx.send(f"{channel.mention} not locked.")
|
||||
await ctx.send(f"{channel.mention} not locked.", hidden=True)
|
||||
return
|
||||
for role in ctx.guild.roles:
|
||||
try:
|
||||
|
@ -752,7 +756,7 @@ class AdminCog(commands.Cog):
|
|||
self.db.jarvis.locks.find({"guild": ctx.guild.id, "active": True})
|
||||
)
|
||||
if not locks:
|
||||
await ctx.send("No lockdown detected.")
|
||||
await ctx.send("No lockdown detected.", hidden=True)
|
||||
return
|
||||
for channel in channels:
|
||||
for role in roles:
|
||||
|
@ -772,7 +776,7 @@ class AdminCog(commands.Cog):
|
|||
)
|
||||
if updates:
|
||||
self.db.jarvis.locks.bulk_write(updates)
|
||||
await ctx.send(f"Server unlocked")
|
||||
await ctx.send("Server unlocked")
|
||||
|
||||
@cog_ext.cog_slash(
|
||||
name="warn",
|
||||
|
@ -899,7 +903,9 @@ class AdminCog(commands.Cog):
|
|||
roles = {"guild": ctx.guild.id, "setting": "roleping", "value": []}
|
||||
|
||||
if role.id in roles["value"]:
|
||||
await ctx.send(f"Role `{role.name}` already in blocklist.")
|
||||
await ctx.send(
|
||||
f"Role `{role.name}` already in blocklist.", hidden=True
|
||||
)
|
||||
return
|
||||
roles["value"].append(role.id)
|
||||
self.db.jarvis.settings.update_one(
|
||||
|
@ -929,11 +935,13 @@ class AdminCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "setting": "roleping"}
|
||||
)
|
||||
if not roles:
|
||||
await ctx.send("No blocklist configured.")
|
||||
await ctx.send("No blocklist configured.", hidden=True)
|
||||
return
|
||||
|
||||
if role.id not in roles["value"]:
|
||||
await ctx.send(f"Role `{role.name}` not in blocklist.")
|
||||
await ctx.send(
|
||||
f"Role `{role.name}` not in blocklist.", hidden=True
|
||||
)
|
||||
return
|
||||
roles["value"].delete(role.id)
|
||||
self.db.jarvis.settings.update_one(
|
||||
|
@ -971,7 +979,7 @@ class AdminCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
)
|
||||
if autopurge:
|
||||
await ctx.send("Autopurge already exists.")
|
||||
await ctx.send("Autopurge already exists.", hidden=True)
|
||||
return
|
||||
autopurge = {
|
||||
"guild": ctx.guild.id,
|
||||
|
@ -1006,7 +1014,7 @@ class AdminCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
)
|
||||
if not autopurge:
|
||||
await ctx.send("Autopurge does not exist.")
|
||||
await ctx.send("Autopurge does not exist.", hidden=True)
|
||||
return
|
||||
self.db.jarvis.autopurge.delete_one({"_id": autopurge["_id"]})
|
||||
await ctx.send(f"Autopurge removed from {channel.mention}.")
|
||||
|
@ -1039,7 +1047,7 @@ class AdminCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
)
|
||||
if not autopurge:
|
||||
await ctx.send("Autopurge does not exist.")
|
||||
await ctx.send("Autopurge does not exist.", hidden=True)
|
||||
return
|
||||
self.db.jarvis.autopurge.update_one(
|
||||
{"_id": autopurge["_id"]}, {"$set": {"delay": delay}}
|
||||
|
|
|
@ -43,7 +43,9 @@ class AutoReactCog(commands.Cog):
|
|||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
)
|
||||
if exists:
|
||||
await ctx.send(f"Autoreact already exists for {channel.mention}.")
|
||||
await ctx.send(
|
||||
f"Autoreact already exists for {channel.mention}.", hidden=True
|
||||
)
|
||||
return
|
||||
|
||||
autoreact = {
|
||||
|
@ -75,9 +77,11 @@ class AutoReactCog(commands.Cog):
|
|||
{"guild": channel.guild.id, "channel": channel.id}
|
||||
)
|
||||
if exists:
|
||||
await ctx.send(f"Autoreact remove from {channel.mention}")
|
||||
await ctx.send(f"Autoreact removed from {channel.mention}")
|
||||
else:
|
||||
await ctx.send(f"Autoreact not found on {channel.mention}")
|
||||
await ctx.send(
|
||||
f"Autoreact not found on {channel.mention}", hidden=True
|
||||
)
|
||||
|
||||
@cog_ext.cog_subcommand(
|
||||
base="autoreact",
|
||||
|
@ -107,13 +111,16 @@ class AutoReactCog(commands.Cog):
|
|||
if not custom_emoji and not standard_emoji:
|
||||
await ctx.send(
|
||||
"Please use either an emote from this server"
|
||||
+ " or a unicode emoji."
|
||||
+ " or a unicode emoji.",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
if custom_emoji:
|
||||
emoji_id = int(custom_emoji.group(1))
|
||||
if not find(lambda x: x.id == emoji_id, ctx.guild.emojis):
|
||||
await ctx.send("Please use a custom emote from this server.")
|
||||
await ctx.send(
|
||||
"Please use a custom emote from this server.", hidden=True
|
||||
)
|
||||
return
|
||||
exists = self.db.jarvis.autoreact.find_one(
|
||||
{"guild": ctx.guild.id, "channel": channel.id}
|
||||
|
@ -126,12 +133,14 @@ class AutoReactCog(commands.Cog):
|
|||
return
|
||||
if emote in exists["reactions"]:
|
||||
await ctx.send(
|
||||
f"Emote already added to {channel.mention} autoreactions."
|
||||
f"Emote already added to {channel.mention} autoreactions.",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
if len(exists["reactions"]) >= 20:
|
||||
if len(exists["reactions"]) >= 5:
|
||||
await ctx.send(
|
||||
"Max number of reactions hit. Remove a different one to add this one"
|
||||
"Max number of reactions hit. Remove a different one to add this one",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
exists["reactions"].append(emote)
|
||||
|
@ -169,12 +178,14 @@ class AutoReactCog(commands.Cog):
|
|||
if not exists:
|
||||
await ctx.send(
|
||||
"Please create autoreact first with "
|
||||
+ f"/autoreact create {channel.mention}"
|
||||
+ f"/autoreact create {channel.mention}",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
if emote not in exists["reactions"]:
|
||||
await ctx.send(
|
||||
f"{emote} not used in {channel.mention} autoreactions."
|
||||
f"{emote} not used in {channel.mention} autoreactions.",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
exists["reactions"].remove(emote)
|
||||
|
@ -206,7 +217,8 @@ class AutoReactCog(commands.Cog):
|
|||
if not exists:
|
||||
await ctx.send(
|
||||
"Please create autoreact first with "
|
||||
+ f"/autoreact create {channel.mention}"
|
||||
+ f"/autoreact create {channel.mention}",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
message = ""
|
||||
|
|
|
@ -33,7 +33,7 @@ class CTCCog(commands.Cog):
|
|||
async def _pw(self, ctx, guess: str):
|
||||
guessed = self.db.ctc2.guesses.find_one({"guess": guess})
|
||||
if guessed:
|
||||
await ctx.send("Already guessed, dipshit.")
|
||||
await ctx.send("Already guessed, dipshit.", hidden=True)
|
||||
return
|
||||
result = await self._session.post(self.url, data=guess)
|
||||
message = ""
|
||||
|
|
|
@ -118,7 +118,7 @@ class DbrandCog(commands.Cog):
|
|||
guild_ids=[862402786116763668, 578757004059738142],
|
||||
description="(not)extortion",
|
||||
)
|
||||
async def _buy(self, ctx):
|
||||
async def _extort(self, ctx):
|
||||
await ctx.send(
|
||||
"Be (not)extorted here: " + self.base_url + "not-extortion"
|
||||
)
|
||||
|
|
|
@ -76,7 +76,8 @@ class DevCog(commands.Cog):
|
|||
if method not in supported_hashes:
|
||||
algo_txt = ", ".join(f"`{x}`" for x in supported_hashes)
|
||||
await ctx.send(
|
||||
"Unsupported hash algorithm. Supported:\n" + algo_txt
|
||||
"Unsupported hash algorithm. Supported:\n" + algo_txt,
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
if not data and len(ctx.message.attachments) == 0:
|
||||
|
@ -119,14 +120,14 @@ class DevCog(commands.Cog):
|
|||
|
||||
async def _uuid(self, ctx, version: str = None, data: str = None):
|
||||
if not version:
|
||||
await ctx.send("Supported UUID versions: 3, 4, 5")
|
||||
await ctx.send("Supported UUID versions: 3, 4, 5", hidden=True)
|
||||
return
|
||||
if version not in ["3", "4", "5"]:
|
||||
await ctx.send("Supported UUID versions: 3, 4, 5")
|
||||
await ctx.send("Supported UUID versions: 3, 4, 5", hidden=True)
|
||||
return
|
||||
version = int(version)
|
||||
if version in [3, 5] and not data:
|
||||
await ctx.send(f"UUID{version} requires data.")
|
||||
await ctx.send(f"UUID{version} requires data.", hidden=True)
|
||||
return
|
||||
if version == 4:
|
||||
await ctx.send(f"UUID4: `{uuid.uuid4()}`")
|
||||
|
@ -233,7 +234,9 @@ class DevCog(commands.Cog):
|
|||
if method not in self.base64_methods:
|
||||
methods = ", ".join(f"`{x}`" for x in self.base64_methods)
|
||||
await ctx.send(
|
||||
"Usage: encode <method> <data>\nSupported methods:\n" + methods
|
||||
"Usage: encode <method> <data>\nSupported methods:\n"
|
||||
+ methods,
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
method = getattr(base64, method + "encode")
|
||||
|
@ -256,7 +259,9 @@ class DevCog(commands.Cog):
|
|||
if method not in self.base64_methods:
|
||||
methods = ", ".join(f"`{x}`" for x in self.base64_methods)
|
||||
await ctx.send(
|
||||
"Usage: decode <method> <data>\nSupported methods:\n" + methods
|
||||
"Usage: decode <method> <data>\nSupported methods:\n"
|
||||
+ methods,
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
method = getattr(base64, method + "decode")
|
||||
|
|
|
@ -58,7 +58,9 @@ class JokeCog(commands.Cog):
|
|||
)[0]
|
||||
|
||||
if result is None:
|
||||
await ctx.send("Humor module failed. Please try again later.")
|
||||
await ctx.send(
|
||||
"Humor module failed. Please try again later.", hidden=True
|
||||
)
|
||||
return
|
||||
emotes = re.findall(r"(&#x[a-fA-F0-9]*;)", result["body"])
|
||||
for match in emotes:
|
||||
|
|
|
@ -66,14 +66,17 @@ class StarboardCog(commands.Cog):
|
|||
async def _create(self, ctx, target: TextChannel):
|
||||
if target not in ctx.guild.channels:
|
||||
await ctx.send(
|
||||
"Target channel not in guild. Choose an existing channel."
|
||||
"Target channel not in guild. Choose an existing channel.",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
exists = self.db.jarvis.starboard.find_one(
|
||||
{"target": target.id, "guild": ctx.guild.id}
|
||||
)
|
||||
if exists:
|
||||
await ctx.send(f"Starboard already exists at {target.mention}.")
|
||||
await ctx.send(
|
||||
f"Starboard already exists at {target.mention}.", hidden=True
|
||||
)
|
||||
return
|
||||
|
||||
self.db.jarvis.starboard.insert_one(
|
||||
|
@ -110,9 +113,13 @@ class StarboardCog(commands.Cog):
|
|||
)
|
||||
if deleted:
|
||||
self.db.jarvis.stars.delete_many({"starboard": target.id})
|
||||
await ctx.send(f"Starboard deleted from {target.mention}.")
|
||||
await ctx.send(
|
||||
f"Starboard deleted from {target.mention}.", hidden=True
|
||||
)
|
||||
else:
|
||||
await ctx.send(f"Starboard not found in {target.mention}.")
|
||||
await ctx.send(
|
||||
f"Starboard not found in {target.mention}.", hidden=True
|
||||
)
|
||||
|
||||
@cog_ext.cog_subcommand(
|
||||
base="star",
|
||||
|
@ -157,7 +164,8 @@ class StarboardCog(commands.Cog):
|
|||
if not exists:
|
||||
await ctx.send(
|
||||
f"Starboard does not exist in {starboard.mention}. "
|
||||
+ "Please create it first"
|
||||
+ "Please create it first",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -174,7 +182,8 @@ class StarboardCog(commands.Cog):
|
|||
|
||||
if exists:
|
||||
await ctx.send(
|
||||
f"Message already sent to Starboard {starboard.mention}"
|
||||
f"Message already sent to Starboard {starboard.mention}",
|
||||
hidden=True,
|
||||
)
|
||||
return
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class UtilCog(commands.Cog):
|
|||
async def _rcauto(self, ctx: SlashContext, text: str):
|
||||
to_send = ""
|
||||
if len(text) == 1 and not re.match(r"^[A-Z0-9-()$@!?^'#. ]$", text):
|
||||
await ctx.send("Please use ASCII characters.")
|
||||
await ctx.send("Please use ASCII characters.", hidden=True)
|
||||
return
|
||||
for letter in text.upper():
|
||||
if letter == " ":
|
||||
|
@ -85,7 +85,7 @@ class UtilCog(commands.Cog):
|
|||
else:
|
||||
to_send += f"<:{names[id]}:{id}>"
|
||||
if len(to_send) > 2000:
|
||||
await ctx.send("Too long.")
|
||||
await ctx.send("Too long.", hidden=True)
|
||||
else:
|
||||
await ctx.send(to_send)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue