Fix unicode error in py2.7 for example plugin
Strings should now be passed to the plugins as unicode values in py2.7 so we have to make sure that we don't convert those into ascii by using python str instead of u'' strings.
This commit is contained in:
parent
2b9e9b752c
commit
c81bdfec99
8 changed files with 41 additions and 11 deletions
|
@ -67,6 +67,8 @@ This will print the incoming message json (dict) to the screen where the bot is
|
|||
|
||||
Plugins having a method defined as ```catch_all(data)``` will receive ALL events from the websocket. This is useful for learning the names of events and debugging.
|
||||
|
||||
Note: If you're using Python 2.x, the incoming data should be a unicode string, be careful you don't coerce it into a normal str object as it will cause errors on output. You can add `from __future__ import unicode_literals` to your plugin file to avoid this.
|
||||
|
||||
####Outgoing data
|
||||
Plugins can send messages back to any channel, including direct messages. This is done by appending a two item array to the outputs global array. The first item in the array is the channel ID and the second is the message text. Example that writes "hello world" when the plugin is started:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue