Skip to content

Instantly share code, notes, and snippets.

@zoni
Created July 17, 2014 01:02
Show Gist options
  • Save zoni/a196c480d3fb6acc547c to your computer and use it in GitHub Desktop.
Save zoni/a196c480d3fb6acc547c to your computer and use it in GitHub Desktop.
self.send() example for Err
[Core]
Name = SendHello
Module = sendhello
[Python]
Version = 2+
[Documentation]
Description = Demonstrating self.send()
from errbot import BotPlugin, botcmd
class SendHello(BotPlugin):
"""Demonstrating self.send()"""
@botcmd
def sendhello(self, msg, args):
"""Send hello back"""
type_ = msg.getType()
from_ = msg.getFrom()
yield ">> Hi there! You sent me a {} message from {}".format(type_, from_)
yield ">> I will now send you a message back on that ID!"
self.send(user=from_, message_type=type_, text="Hello!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment