CactusDev / CactusBot

An open source, community-written service-agnostic chat bot
MIT License
30 stars 5 forks source link

MessagePacket support within magic commands #66

Closed 2Cubed closed 7 years ago

2Cubed commented 8 years ago

Currently, magic commands are based entirely around raw strings, which defeats the purpose of the typed MessagePackets in some sense. Magic commands should be able to use MessagePackets for added functionalities. (Emoji detection, tag usage, etc.)

Innectic commented 8 years ago

I thought they could return them already? I had some magic commands that did that, but, you changed them all to strings

2Cubed commented 8 years ago

@Innectic They can return them. (I changed most back to raw strings, though, because MessagePacket(raw_str) all over the place is messy - only necessary for, say, action=True, target="user", etc.) They don't receive them, though.

For example, in the !cube command, we need to be able to detect which arguments are emojis. Currently, we're using Beam-specific parsing, which is labeled as a # HACK - if we use the already-typed MessagePackets, though, we could easily just use if chunk["type"] == "emoji".

2Cubed commented 7 years ago

We could potentially use another special kwarg-only argument, raw, to contain the raw MessagePacket.

2Cubed commented 7 years ago

Done.

We can consider a purely packet-based command system in the future; for now, though, this is :ok_hand:.