Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(70)  |  Call(58)  |  Derive(0)  |  Import(12)
Send a message to a target.

:param target: Target to send the message to. Can be a channel or user
:param message: One or more messages to send
:param log: Whether or not to log the message

        def msg(target, message, log=True):
    """Send a message to a target.

    :param target: Target to send the message to. Can be a channel or user
    :param message: One or more messages to send
    :param log: Whether or not to log the message
    """
    try:
        if not isinstance(message, basestring):
            for _message in iter(message):
                if _message == "":
                    continue
                _BOT.msg(target, _message, log)
        else:
            if message == "":
                return
            _BOT.msg(target, message, log)
    except TypeError:
        if message == "":
            return
        _BOT.msg(target, message, log)
        


src/l/a/lala-0.3/lala/plugins/log.py   lala(Download)
import logging.handlers
 
from lala.util import command, msg, regex
 
 
        _lines = _file.readlines()
    lines = min(lines, len(_lines))
    msg(user, _lines[-lines:], log=False)
 
 

src/l/a/lala-0.3/lala/plugins/last.py   lala(Download)
import lala.config
 
from datetime import datetime
from lala.util import command, msg, regex
 
        num_lines = max_lines
    num_lines = min(num_lines, len(_chatlog))
    msg(user, _chatlog[-num_lines:], log=False)
 
 

src/l/a/lala-0.3/lala/plugins/roulette.py   lala(Download)
import random
from lala.util import command, msg
 
class revolver:
    def __init__(self):
    def shoot(self, user, channel, text):
        if (self.chamber >= 5) and (self.chamber != self.bullet):
            msg(channel, "%s: Chamber %s of 6: *click*" % (user, self.chamber))
            msg(channel, "Reloading")
            self.reload()
 
        elif (self.chamber == self.bullet):
            msg(channel, "%s: Chamber %s of 6: BOOM" % (user, self.chamber))
            self.reload()
            msg(channel, "Reloading")

src/l/a/lala-0.3/lala/plugins/anime.py   lala(Download)
import anidb
import logging
 
from lala.util import command, msg
from lala.config import get_int, set_default_options
def get_anime(user, channel, text):
    try:
        aid = int(text.split()[1])
    except ValueError:
        msg(channel, "%s: %s can't be parsed into an anime id" % (user,
        anime = anidb.query(anidb.QUERY_ANIME, aid)
    except anidb.exceptions.BannedException:
        msg(channel, "%s: Sorry, looks like I'm banned from using the HTTP api"
                % user)
        return None
    if anime is None:
        logging.info("No data")
        msg(channel, "%s: Sorry, no data could be retrieved" % user)
    anime.tags.reverse()
    tags = [tag.name for tag in anime.tags]
    msg(channel, "Anime %s is tagged %s" % (anime.id,
            ", ".join(tags[:get_int("max_tags")])))
 

src/l/a/lala-0.3/lala/plugins/base.py   lala(Download)
import lala.pluginmanager
 
from lala.util import command, msg
from twisted.internet import reactor
 
def server(user, channel, text):
    """Shows the server the bot is connected to"""
    msg(user, util._BOT.server)
 
@command
def commands(user, channel, text):
    """Prints all available callbacks"""
    msg(channel, "I know the following commands:")
    s = "!" + " !".join(lala.pluginmanager._callbacks)
    msg(channel, s)
def addadmin(user, channel, text):
    """Add a user to the list of admins"""
    admin = text.split()[1]
    if admin in config.get("admins"):
        msg(channel, "%s already is an admin" % admin)

src/l/a/lala-0.3/lala/plugins/birthday.py   lala(Download)
from ConfigParser import NoOptionError
import logging
 
from datetime import datetime, date, timedelta
from lala.util import command, msg, on_join
            date_of_birth = datetime.strptime(date_to_parse, _CONFIG_TIME_FORMAT)
    except ValueError:
        msg(channel, "Sorry %s, I couldn't parse %s into a valid date" % (date_to_parse))
        return
 
    today = date.today()
    if date_of_birth == today:
        msg(channel, "\o\ Happy birthday, %s /o/" % user)
        date_of_birth = date_of_birth + timedelta(days=365)
        set(user, date_of_birth.strftime(_CONFIG_TIME_FORMAT))

src/l/a/lala-0.3/lala/plugins/down.py   lala(Download)
import urllib2
import logging
 
 
from lala.util import msg, command
    def callback(content):
        if "It's just you" in content:
            msg(channel, "%s: It's just you!" % user)
        else:
            msg(channel, "%s: It's not just you!" % user)
 
    def errback(error):
        msg(channel, "%s: Sorry, something went wrong while processing your request." % user)

src/l/a/lala-0.3/lala/plugins/quotes.py   lala(Download)
from collections import defaultdict
from functools import partial
from lala.util import command, msg, on_join
from lala.config import get, get_int, set_default_options
from twisted.enterprise import adbapi
    def callback(quotes):
        if len(quotes) > 0:
            _send_quote_to_channel(channel, quotes[0])
        else:
            msg(channel, "%s: There's no quote #%s" % (user,
    def msgcallback(c):
        msg(channel, "New quote: %s" % c[0])
 
    def addcallback(c):
        # TODO This might not be the rowid we're looking for in all cases…
                add)
    else:
        msg(channel, "%s: You didn't give me any text to quote " % user)
 
@command(admin_only=True)
        def callback(changes):
            if changes > 0:
                msg(channel, "Quote #%s has been deleted." % quotenumber)
                return
            else:

src/l/a/lala-0.3/lala/plugins/decide.py   lala(Download)
from random import choice
from lala.util import command, msg
 
@command
def decide(user, channel, text):
    """Pick one choice in an arbitrary list of choices separated by a slash"""
    s_text = text.split("/")
    s_text[0] = " ".join(s_text[0].split()[1:])
    msg(channel, "%s: %s" %(user, choice(s_text)))

src/l/a/lala-0.3/lala/plugins/calendar.py   lala(Download)
import logging
 
 
from datetime import date
from lala.util import msg, command
def weeknum(user, channel, text):
    """Echoes the current week number."""
    d = date.today()
    year, weeknum, weekday = d.isocalendar()
    msg(channel, "It's week #%i of the year %i." % (weeknum, year))

  1 | 2  Next