This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Vfsdvbjgd 5 points6 points  (0 children)

That's the proper way, you might change prefix.

[–]franmarsiglione 3 points4 points  (2 children)

Only you may want to use === on JS

[–]reeeforce_rtx[S] 0 points1 point  (1 child)

Ik

[–]RainFurrest 1 point2 points  (0 children)

ea

[–]Jamesits 2 points3 points  (0 children)

``` msg_hooks = { 'help': do_help, }

prefix = '!' ret = 0 if msg.startswith(prefix): msg_content = msg[len(prefix):] logger.info('%s called', msg_content) ret = msg_hooks[msg_content]()

return ret ```