Change order of checks to make more sense

This commit is contained in:
Zeva Rose 2022-04-20 00:52:29 -06:00
parent 4601789da0
commit a79d7e1bf4

View file

@ -69,11 +69,6 @@ class RedditCog(Scale):
await ctx.send("Subreddit may be private, quarantined, or nonexistent.", ephemeral=True) await ctx.send("Subreddit may be private, quarantined, or nonexistent.", ephemeral=True)
return return
count = len([i async for i in SubredditFollow.find(q(guild=ctx.guild.id))])
if len(count) >= 12:
await ctx.send("Cannot follow more than 12 Subreddits", ephemeral=True)
return
exists = await SubredditFollow.find_one( exists = await SubredditFollow.find_one(
q(display_name=subreddit.display_name, guild=ctx.guild.id) q(display_name=subreddit.display_name, guild=ctx.guild.id)
) )
@ -81,6 +76,11 @@ class RedditCog(Scale):
await ctx.send("Subreddit already being followed in this guild", ephemeral=True) await ctx.send("Subreddit already being followed in this guild", ephemeral=True)
return return
count = len([i async for i in SubredditFollow.find(q(guild=ctx.guild.id))])
if len(count) >= 12:
await ctx.send("Cannot follow more than 12 Subreddits", ephemeral=True)
return
sr = await Subreddit.find_one(q(display_name=subreddit.display_name)) sr = await Subreddit.find_one(q(display_name=subreddit.display_name))
if not sr: if not sr:
sr = Subreddit(display_name=subreddit.display_name, over18=subreddit.over18) sr = Subreddit(display_name=subreddit.display_name, over18=subreddit.over18)