Change nsfw filtering

This commit is contained in:
Zeva Rose 2022-05-02 13:58:19 -06:00
parent abbb02f07a
commit 602cea9058

View file

@ -255,8 +255,14 @@ class RedditCog(Scale):
return return
embeds = await self.post_embeds(subreddit, post) embeds = await self.post_embeds(subreddit, post)
ephemeral = post.over_18 and not ctx.channel.nsfw if post.over_18 and not ctx.channel.nsfw:
await ctx.send(embeds=embeds, ephemeral=ephemeral) try:
await ctx.author.send(embeds=embeds)
await ctx.send("Hey! Due to content, I had to DM the result to you")
except Exception:
await ctx.send("Hey! Due to content, I cannot share the result")
else:
await ctx.send(embeds=embeds)
@reddit.subcommand(sub_cmd_name="top", sub_cmd_description="Get the top post of a subreddit") @reddit.subcommand(sub_cmd_name="top", sub_cmd_description="Get the top post of a subreddit")
@slash_option( @slash_option(
@ -297,6 +303,13 @@ class RedditCog(Scale):
return return
embeds = await self.post_embeds(subreddit, post) embeds = await self.post_embeds(subreddit, post)
if post.over_18 and not ctx.channel.nsfw:
try:
await ctx.author.send(embeds=embeds)
await ctx.send("Hey! Due to content, I had to DM the result to you")
except Exception:
await ctx.send("Hey! Due to content, I cannot share the result")
else:
await ctx.send(embeds=embeds) await ctx.send(embeds=embeds)
@reddit.subcommand( @reddit.subcommand(
@ -326,8 +339,14 @@ class RedditCog(Scale):
return return
embeds = await self.post_embeds(subreddit, post) embeds = await self.post_embeds(subreddit, post)
ephemeral = post.over_18 and not ctx.channel.nsfw if post.over_18 and not ctx.channel.nsfw:
await ctx.send(embeds=embeds, ephemeral=ephemeral) try:
await ctx.author.send(embeds=embeds)
await ctx.send("Hey! Due to content, I had to DM the result to you")
except Exception:
await ctx.send("Hey! Due to content, I cannot share the result")
else:
await ctx.send(embeds=embeds)
@reddit.subcommand( @reddit.subcommand(
sub_cmd_name="rising", sub_cmd_description="Get a rising post of a subreddit" sub_cmd_name="rising", sub_cmd_description="Get a rising post of a subreddit"
@ -356,8 +375,14 @@ class RedditCog(Scale):
return return
embeds = await self.post_embeds(subreddit, post) embeds = await self.post_embeds(subreddit, post)
ephemeral = post.over_18 and not ctx.channel.nsfw if post.over_18 and not ctx.channel.nsfw:
await ctx.send(embeds=embeds, ephemeral=ephemeral) try:
await ctx.author.send(embeds=embeds)
await ctx.send("Hey! Due to content, I had to DM the result to you")
except Exception:
await ctx.send("Hey! Due to content, I cannot share the result")
else:
await ctx.send(embeds=embeds)
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None: