-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added Application Commands #4
base: main
Are you sure you want to change the base?
Conversation
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.
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)
@@ -260,6 +260,282 @@ async def on_message_edit(before, after): | |||
ctx = await bot.get_context(after) | |||
await bot.invoke(ctx) | |||
|
|||
@bot.user_command(name="Join Position") |
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.
Command is extraneous, already exists and in better implementation.
await ctx.send(embed=embed) | ||
|
||
|
||
MORSE_CODE_DICT = { |
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.
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.") |
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.
This is childish, and doesn't even work as intended as someone could easily add another character to bypass this.
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.
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
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.
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()) |
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.
The allowed_mentions kwarg is redundant, it's set by default in the custom bot class.
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.
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.") |
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.
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.
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.
They aren't checks, just little easter eggs
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.
@binary.command(name="encrypt") | ||
async def binary_encrypt(ctx, | ||
text: Option( | ||
str, "The string you want to convert to binary")): |
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.
This formatting hurts to look at.
|
||
ascii_string += ascii_character | ||
|
||
await ctx.send(ascii_string, |
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.
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')): |
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 time_str here. It's a module I wrote for exactly this kind of thing.
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.
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: |
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.
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') |
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.
There shouldn't be 2 commands for this. Use an optional parameter in one command that defaults to 0.
Please add a changelog entry |
No description provided.