-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ban updates2.0 #2293
base: master
Are you sure you want to change the base?
Ban updates2.0 #2293
Conversation
…variable names in wall_e_ban function
…o /ban and intercept()
…ages are predetermined and cannot break limits
…ses to guild.ban to accomplish message clearning so its instant
…t getting audit log data
Seems my first branch has some commits from master that've since been removed. So I made this fresh branch and cherry picked my commits over. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the embed helper back. the checks against the text sizes was just 1 thing it does. hint take a look at line of code under 180 on embed.py
ef91068
to
41712f3
Compare
08e135d
to
2bc735e
Compare
The embeds in ban that I changed don't set author or author icon, so there's no need for the utility. |
Not using the embed utilitiy function made the code simpler plus its faster: Run # 1 Run # 2 Run # 3 Run # 4 Run # 5 Run # 6 Run # 7 Run # 8 Run # 9 Run # 10 Fast Factors |
code i used for the tests. called @commands.command()
async def go(self, ctx, num: int):
times = [0 for _ in range(1, num+1)]
for idx in range(1, num+1):
await ctx.send(f"**Run #{idx}**")
times[idx-1] = await self.time(ctx)
avg = sum(times)/num
times = (
"**Fast Factor**\n"
f"[ {', '.join([f'{t:.4f}' for t in times])}]\n"
f"Avg: {avg:.4f}"
)
await ctx.send(times)
@commands.command()
async def time(self, ctx):
times = [0 for _ in range(1, 11)]
times2 = [0 for _ in range(1, 11)]
ban_date = pstdatetime.now()
for idx in range(1, 11):
start = time.time()
e_obj = discord.Embed(title=f"Time testing #{idx}", color=discord.Color.red())
e_obj.add_field(name="Banned User", value=f"**Username**")
e_obj.add_field(name="Moderator", value=f"**Mod Name**")
e_obj.add_field(name="Reason", value=f"```Ban Reason```", inline=False)
e_obj.add_field(name="User Notified via DM", value="No", inline=False)
e_obj.set_footer(text="Moderator Action")
e_obj.timestamp = ban_date
end = time.time()
times[idx-1] = end - start
await asyncio.sleep(1)
for idx in range(1, 11):
start = time.time()
content = [
("Banned User", "**Username**", True),
("Moderator", "**Mod Name**", True),
("Reason", "```Ban Reason```", False),
("User Notified via DM", "No", False)
]
e_obj = await embed(
logger=self.logger,
ctx=ctx,
title=f"Time testing #{idx}",
colour=WallEColour.ERROR,
content=content,
footer_text="Moderator Action",
timestamp=ban_date
)
if e_obj:
end = time.time()
times2[idx - 1] = end - start
await asyncio.sleep(1)
av1 = sum(times)/10
av2 = sum(times2)/10
fast = av2/av1
await ctx.send(
(f"discord.Embed avg time: `{av1:.10f}`\n"
f"utility.embed avg time: `{av2:.10f}`\n"
f"discord.Embed is `{fast:.4f}` times faster than utility.embed")
)
return fast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the wall_e embed utility to ensure consistency and then I will take a look
Description