#Bridge commands - more efficient way editing messages

1 messages · Page 1 of 1 (latest)

versed ingot
#

Basically, what I'm trying to do is edit a message in a bridge command. I don't want to run try and except (so trying for message.edit, except it does message.edit_original_message) for every single command. It'll look messy and just havoc to maintain.

Using if statements is going to look the same thing, I don't want to repeat the same thing in every single command. Any ideas? Can I setup something globally for all commands?

I also want to do something similar with replying as well. For slash commands, it replies, but for normal prefix commands, no replies happen.

atomic pawn
cinder swanBOT
#

Here's the custom context example.

versed ingot
#

Hmmm, so where would I edit so:

  • replies wouldn’t be done for normal prefix messages;
  • editing messages is more straight forward.
versed ingot
#

And also how would I apply this in cogs?

atomic pawn
versed ingot
atomic pawn
#

no

#

so something like:

from main import CustomContextClass

class CogThing(discord.Cog):
  @bridge.bridge.command()
  async def foo(self, ctx: CustomContextClass):
    ...
versed ingot
#

So I have to define what ctx is every time?

#

There's no better way of doing this?

atomic pawn
versed ingot
#

Could I write a function, perhaps? And then run that when editing things/replying?

versed ingot
#

because omg this is making my eyes melt

versed ingot
atomic pawn
#

and then do your ifs there

versed ingot
#

Ooo kk cool, will do

#

How do you detect whether its a slash command/prefix command? @atomic pawn

#

(Sorry for ping, its getting quite late for me and really wanna get this done ASAP, sorry for my impatience)

versed ingot
#

AttributeError: 'NoneType' object has no attribute 'created_at'
Am also getting this when dealing with embeds 😓

atomic pawn
tawny finch
#

@versed ingot if that fixed your problem please use /close :)