Giter Club home page Giter Club logo

jabberbot's Introduction

jabberbot Build Status

A Jabber Bot for my XMPP service. Written in Python.

Prerequisites

Setup

The environment is based on Vagrant. But this is optional. You still can test und run everything without it but with Vagrant you don't have to care about anything. Just type a simple

$ vagrant up

and everything will be set up for you. After that you can ssh into the VM

$ vagrant ssh

After that you can run all Python related commands within the VM. All dependencies and environment variables are already set for you. Now you can modify and add any file on the host just like in any development environment. If you are done you can synchronize your changes to the guest manually

$ vagrant rsync

If you want to synchronize automatically every change you can do

$ vagrant rsync-auto

in a separate terminal window.

Commands

All commands are defined in the jabberbot.commands package. If you want to add a command to the bot you add a Python module with the name the command should be. For example if you add the module foo.py to the jabberbot.commands package the command will be available as !foo. In foo.py you can make everything you want and everything you can do with Python. The only thing that must exist is a function with the signature

def run_command(msg, *args):
  return 'groupchat', 'hello world'

This function will be called if a user wrote the command to the chat room. The first argument msg is the raw XMPP message. The second argument *args is a tuple with optional arguments. For example the user can call a command without arguments like !help or with arguments like !help foo bar.

run_command must return a tuple with two items. The first item defines where the response should be sent. Either to the groupchat or as private chat. The second item is the message as a string.

Unit tests

All unit tests run without any plugins. Everything is shipped with the Python standard library. Just run it with a simple

$ python -m unittest

Test in a chat room

If you want to test your command in a real world environment, a chat room, and not only in unit tests you can use the provided chatroom_test.py script. Just fill all predefined variables and run your script

$ python chatroom_test.py

jabberbot's People

Contributors

elensar avatar peterjuras avatar screendriver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jabberbot's Issues

!pokemon

Should return a random legacy (151) pokemon name.
E.g.:
"A wild Pikachu appears!"

Add !cool

A second bot enters the MUC and says "Cool!". The name of the Bot is random and can be one if these:

  • Deine Mutter
  • Bruce Willis
  • Jack Bauer
  • Matt Damon
  • James Bond
  • Carlos Spicy Wiener

admin command.

Hello bro
i think
do you can add admin command ?

i hope u can do it.
thanks you

Add cite functionality

I suggest implementing the following commands

!lgadd gathers the last chat message within a channel and saves it into a collection of cites.
eg:

 <rob> Ein Drache und ein Krieger, kämpfen auf dem Berg, Airbrushgemälde,...
 [someone calls !lgadd]
 <jabberbot> Leider geil!
 [cite from rob is saved into the collection]

!leidergeil outputs a random cite from the collection
eg:

 <someUser> !leidergeil
 <jabberbot> Cite by rob: "Ein Drache und ein Krieger, kämpfen auf dem Berg, Airbrushgemälde,..." -- Leider geil (#1, 09/15/2015)

!leidergeil #id outputs the cite with id from the collection
eg:

 <someUser> !leidergeil #1
 <jabberbot> Cite by rob: "Ein Drache und ein Krieger, kämpfen auf dem Berg, Airbrushgemälde,..." -- Leider geil (#1, 09/15/2015)

!wakeup

If a person is too long away in the MUC call the person via Sipgate API. Let it ring two times and then hung up.

"besser isses" on leave

If someone leaves the MUC the bot should show a "besser isses" message. This message should appear randomly and not always.

"Has anyone said my name?" is missing

The Bot should listen if in a message contains special names. If so a second Bot with this name enteres the MUC and says "Hat da jemand meinen Namen gesagt?"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.