[Tutor] (no subject)

Keitaro Kaoru tokyo.rook at gmail.com
Mon May 14 11:58:17 CEST 2012


sorry if i keep missing this up.

hey. Austin here for some reason this command. all it does it produces the
error message at the bottom.. itll say my name and the persons name im
trying to send the message to but thats it. heres the command.

################################################################
# Imports
################################################################
from tools import Html, Error, Text, shared_db, log
import urllib.request as urlreq
import urllib.parse as urlpar
import xml.dom.minidom as xdm
import random
import time
import json
import re
import ch

mgr.addCommand("tell", 1, "send a person a message to the rooms he is in",
tell, unlisted = True)

def tell(mgr, croom, user, msg, args):
        name = args.lower().split(" ")[0]
        if not name.isalnum(): return Html("Non-alphanumeric name, seriously?")
        data = shared_db.get("seen:" + name)
        if data == None:
                return Html("I have no records about this user.")
        data = json.loads(data)
        for room in mgr.rooms:
                if data[1] == "join":
                        mgr.sendObject(target,
Html("<b>%s</b>,<b><font color='#3399CC'>%s</font></b>  wants to tell
you<b><i>%s</i> </b>", name.title, user.name.title$
        else:
                        return Error("<b>%s</b>  I couldn't find %s
anywhere", user.name.title(), name.title())

i built it off these 2 commands

def broadcast(mgr, croom, user, msg, args):
        for room in mgr.rooms:
                mgr.sendObject(room, Html("Broadcast by<b>%s</b>:%s",
user.name, args))

def seen(mgr, room, user, msg, args):
name = args.lower().split(" ")[0]
if not name.isalnum(): return Html("Non-alphanumeric name, seriously?")
data = shared_db.get("seen:" + name)
if data == None:
        return Html("I have no records about this user.")
data = json.loads(data)
ifdata[1] == "join":
        return Html("Last seen<b>%s</b>  join<b>%s</b>,<b>%s</b>
ago.", name, data[0], tdelta(data[2]))
elif data[1] == "leave":
        return Html("Last seen<b>%s</b>  leave<b>%s</b>,<b>%s</b>
ago.", name, data[0], tdelta(data[2]))
elif data[1] == "message":
        return Html("Last seen<b>%s</b>  message in<b>%s</b>,<b>%s</b>
 ago: <i>\"%s\"</i>", name, data[0], tdelta(data[2]), data[3])
        return Html("I have no records about this user.")

as you can see i only use some of the command. it doesnt produce an error
message tho.. just repeats "return Error("<b>%s</b>  I couldn't find %s
anywhere", user.name.title(), name.title())"



On Sat, May 12, 2012 at 10:28 PM, bob gailer <bgailer at gmail.com> wrote:
>
> On 5/12/2012 6:34 PM, Keitaro Kaoru wrote:
>
> hey i keep having a problem with adding commands.. i get this error message
>
> Traceback (most recent call last):
>   File "bot.py", line 23, in <module>
>     import modules.core, modules.ai, modules.dict, modules.fun, modules.kc, modules.games, modules.lulz2, modules.modding, modules.meta, modules.mpd, modules.post, modules.poll, modules.util, modules.yt
>   File "/home/digest/digest/modules/core.py", line 170
>     def pm(mgr, room, user, msg, args):
>       ^
> SyntaxError: invalid syntax
>
> Thanks for posting the traceback. All we need is to see more of the program (especially the lines before the one you posted. It is always a good idea to post more of the code regardless of the problem.
>
> --
> Bob Gailer
> 919-636-4239
> Chapel Hill NC




--
~Keitaro Kaoru-Sama~


More information about the Tutor mailing list