Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Added Application Commands#4

Open
BruceCodesGithub wants to merge 1 commit intoPycord-Development:mainfrom
BruceCodesGithub:patch-3
Open

Added Application Commands#4
BruceCodesGithub wants to merge 1 commit intoPycord-Development:mainfrom
BruceCodesGithub:patch-3

Conversation

@BruceCodesGithub
Copy link

No description provided.

Copy link
Contributor

@BobDotCom BobDotCom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of issues here. Rewriting is highly advised. With the amount of ctx.send and ctx.respond inconsitencies, it seems this code is just copied from other bots. (In fact, it is. It's copied from some of my bots)

ctx = await bot.get_context(after)
await bot.invoke(ctx)

@bot.user_command(name="Join Position")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command is extraneous, already exists and in better implementation.

await ctx.send(embed=embed)


MORSE_CODE_DICT = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, this is stolen from https://www.geeksforgeeks.org/morse-code-translator-python/ (which was arguably stolen from https://www.tutorialspoint.com/morse-code-translator-in-python but that's another story). Anyways, I'll likely write a better implementation of this that allows for a universal encode/decode/compile command with subcommands for each language, closer supporting my brainfuck commands with this. Same goes for all the other encode/decode commands here.

async def _frombinary(ctx, message: discord.message):

if message.content.lower() == "01000000 01100101 01110110 01100101 01110010 01111001 01101111 01101110 01100101":
await ctx.respond("SMH. Allowed mentions are turned off. go do something better.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is childish, and doesn't even work as intended as someone could easily add another character to bypass this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I forgot to remove that Easter Egg in the PR, besides, allowed mentions are turned off so it wouldn't actually be Bypassed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's part of my point. There isn't any need for this so why have it.

ascii_string += ascii_character

await ctx.send(ascii_string,
allowed_mentions=discord.AllowedMentions.none())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The allowed_mentions kwarg is redundant, it's set by default in the custom bot class.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see

await ctx.respond("01010000 01110010 01101111 01100010 01100001 01100010 01101100 01111001 00100000 01101110 01101111 01110100")

elif message.content.lower() == '@everyone':
await ctx.respond("Wow, you though allowed mentions were on? Smh.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is childish, and doesn't even work as intended as someone could easily add another character to bypass this. Same goes for all of the other checks here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't checks, just little easter eggs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An if statement is a check.
Screen Shot 2021-10-01 at 10 27 58 AM

@binary.command(name="encrypt")
async def binary_encrypt(ctx,
text: Option(
str, "The string you want to convert to binary")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting hurts to look at.


ascii_string += ascii_character

await ctx.send(ascii_string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send() is incorrect here.


@slowmode.command(name='set', description='Set the slowmode of the current channel')
@commands.has_role(881407111211384902)
async def set(ctx, time:Option(int, 'Enter the time in seconds')):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use time_str here. It's a module I wrote for exactly this kind of thing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

@slowmode.command(name='set', description='Set the slowmode of the current channel')
@commands.has_role(881407111211384902)
async def set(ctx, time:Option(int, 'Enter the time in seconds')):
if time > 21600:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using datetime timedelta objects is more readable here. time_str uses timedelta.

await ctx.channel.edit(slowmode_delay=time)
await ctx.respond(f"The slowmode of this channel has been changed to {humanize.precisedelta(time)} ({time}s)")

@slowmode.command(name='off', description='Remove the slowmode from the current channel')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be 2 commands for this. Use an optional parameter in one command that defaults to 0.

@pullapprove4
Copy link

pullapprove4 bot commented Jul 27, 2023

Please add a changelog entry

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants