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 into
Pycord-Development:mainfrom
BruceCodesGithub:patch-3
Open

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

Conversation

@BruceCodesGithub

Copy link
Copy Markdown

No description provided.

@BobDotCom BobDotCom left a comment

Copy link
Copy Markdown
Contributor

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)

Comment thread main.py
ctx = await bot.get_context(after)
await bot.invoke(ctx)

@bot.user_command(name="Join Position")

Copy link
Copy Markdown
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.

Comment thread main.py
await ctx.send(embed=embed)


MORSE_CODE_DICT = {

Copy link
Copy Markdown
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.

Comment thread main.py
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread main.py
ascii_string += ascii_character

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

Copy link
Copy Markdown
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
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah, I see

Comment thread main.py
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread main.py
@binary.command(name="encrypt")
async def binary_encrypt(ctx,
text: Option(
str, "The string you want to convert to binary")):

Copy link
Copy Markdown
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.

Comment thread main.py

ascii_string += ascii_character

await ctx.send(ascii_string,

Copy link
Copy Markdown
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.

Comment thread main.py

@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
Copy Markdown
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
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alright

Comment thread main.py
@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
Copy Markdown
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.

Comment thread main.py
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
Copy Markdown
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

pullapprove4 Bot commented Jul 27, 2023

Copy link
Copy Markdown

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