Added Application Commands#4
Added Application Commands#4BruceCodesGithub wants to merge 1 commit intoPycord-Development:mainfrom BruceCodesGithub:patch-3
Conversation
BobDotCom
left a comment
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Command is extraneous, already exists and in better implementation.
| await ctx.send(embed=embed) | ||
|
|
||
|
|
||
| MORSE_CODE_DICT = { |
There was a problem hiding this comment.
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.
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.
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.
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.
The allowed_mentions kwarg is redundant, it's set by default in the custom bot class.
| 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.
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.
They aren't checks, just little easter eggs
| @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.
This formatting hurts to look at.
|
|
||
| ascii_string += ascii_character | ||
|
|
||
| await ctx.send(ascii_string, |
There was a problem hiding this comment.
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.
Please use time_str here. It's a module I wrote for exactly this kind of thing.
| @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.
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.
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.