mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2024-12-23 06:35:34 +00:00
Fix style in invites.py and logs.py
This commit is contained in:
parent
6760508e99
commit
2ccc10174d
|
@ -14,11 +14,20 @@ class Invites(Cog):
|
|||
async def invite(self, ctx):
|
||||
welcome_channel = self.bot.get_channel(config.welcome_channel)
|
||||
author = ctx.message.author
|
||||
reason = f"Created by {author.name}#{author.discriminator} ({author.id})"
|
||||
invite = await welcome_channel.create_invite(max_age = 0, max_uses = 1, temporary = True, unique = True, reason = reason)
|
||||
reason = f"Created by {str(author)} ({author.id})"
|
||||
invite = await welcome_channel.create_invite(max_age = 0,
|
||||
max_uses = 1, temporary = True, unique = True, reason = reason)
|
||||
|
||||
with open("data/invites.json", "r") as f:
|
||||
invites = json.load(f)
|
||||
invites[invite.id] = { "uses": 0, "url": invite.url, "max_uses": 1, "code": invite.code }
|
||||
|
||||
invites[invite.id] = {
|
||||
"uses": 0,
|
||||
"url": invite.url,
|
||||
"max_uses": 1,
|
||||
"code": invite.code
|
||||
}
|
||||
|
||||
with open("data/invites.json", "w") as f:
|
||||
f.write(json.dumps(invites))
|
||||
|
||||
|
@ -26,7 +35,8 @@ class Invites(Cog):
|
|||
try:
|
||||
await ctx.author.send(f"Created single-use invite {invite.url}")
|
||||
except discord.errors.Forbidden:
|
||||
await ctx.send(ctx.author.mention + " I could not send you the invite. Send me a DM so I can reply to you.")
|
||||
await ctx.send(f"{ctx.author.mention} I could not send you the \
|
||||
invite. Send me a DM so I can reply to you.")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
|
|
10
cogs/logs.py
10
cogs/logs.py
|
@ -37,7 +37,12 @@ class Logs(Cog):
|
|||
# Add unknown active invites. Can happen if invite was manually created
|
||||
for invite in real_invites:
|
||||
if invite.id not in invites:
|
||||
invites[invite.id] = { "uses": 0, "url": invite.url, "max_uses": invite.max_uses, "code": invite.code }
|
||||
invites[invite.id] = {
|
||||
"uses": 0,
|
||||
"url": invite.url,
|
||||
"max_uses": invite.max_uses,
|
||||
"code": invite.code
|
||||
}
|
||||
|
||||
probable_invites_used = []
|
||||
items_to_delete = []
|
||||
|
@ -68,7 +73,8 @@ class Logs(Cog):
|
|||
elif len(probable_invites_used) == 0:
|
||||
invite_used = "Unknown"
|
||||
else:
|
||||
invite_used = "One of: " + ", ".join([x["code"] for x in probable_invites_used])
|
||||
invite_used = "One of: "
|
||||
invite_used += ", ".join([x["code"] for x in probable_invites_used])
|
||||
|
||||
# Check if user account is older than 15 minutes
|
||||
age = member.joined_at - member.created_at
|
||||
|
|
Loading…
Reference in a new issue