Browse Source

smol refactoring

tags/v1.7.0
Roxie Gibson 6 years ago
parent
commit
bd139e3c90
1 changed files with 12 additions and 10 deletions
  1. +12
    -10
      Roxbot/cogs/gss.py

+ 12
- 10
Roxbot/cogs/gss.py View File

@@ -10,29 +10,31 @@ import Roxbot
from Roxbot import guild_settings



def is_gss():
return commands.check(lambda ctx: ctx.guild.id == 393764974444675073)


def is_not_nsfw_disabled():
def predicate(ctx):
role = discord.utils.get(ctx.guild.roles, id=397866388145831937)
return role not in ctx.author.roles
return commands.check(lambda ctx: predicate(ctx))


def tatsumaki_api_call(member, guild):
base = "https://api.tatsumaki.xyz/"
url = base + "guilds/" + str(guild.id) + "/members/" + str(member.id) + "/stats"
r = requests.get(url, headers={"Authorization": Roxbot.tat_token})
try:
return r.json()
except json.JSONDecodeError:
return {}

class GaySoundsShitposts():
def __init__(self, bot_client):
self.bot = bot_client
self.acceptable_roles = (394939389823811584, 394941004043649036)

def tatsumaki_api_call(self, member, guild):
base = "https://api.tatsumaki.xyz/"
url = base + "guilds/" + str(guild.id) + "/members/" + str(member.id) + "/stats"
r = requests.get(url, headers={"Authorization": Roxbot.tat_token})
try:
return r.json()
except json.JSONDecodeError:
return {}

@bot.command(hidden=True)
async def perms(self, ctx, role):
@@ -44,7 +46,7 @@ class GaySoundsShitposts():
member = ctx.author
required_score = settings.gss["required_score"]
days = int(settings.gss["required_days"])
data = self.tatsumaki_api_call(member, ctx.guild)
data = tatsumaki_api_call(member, ctx.guild)
if not data:
return await ctx.send("Tatsumaki API call returned nothing. Maybe the API is down?")


Loading…
Cancel
Save