Advertisement
DjAussie

Untitled

May 14th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. hey. Austin here for some reason this command. all it does it produces the
  2. error message at the bottom.. itll say my name and the persons name im
  3. trying to send the message to but thats it. heres the command.
  4.  
  5. ################################################################
  6. # Imports
  7. ################################################################
  8. from tools import Html, Error, Text, shared_db, log
  9. import urllib.request as urlreq
  10. import urllib.parse as urlpar
  11. import xml.dom.minidom as xdm
  12. import random
  13. import time
  14. import json
  15. import re
  16. import ch
  17.  
  18. mgr.addCommand("tell", 1, "send a person a message to the rooms he is in",
  19. tell, unlisted = True)
  20.  
  21. def tell(mgr, croom, user, msg, args):
  22. name = args.lower().split(" ")[0]
  23. if not name.isalnum(): return Html("Non-alphanumeric name, seriously?")
  24. data = shared_db.get("seen:" + name)
  25. if data == None:
  26. return Html("I have no records about this user.")
  27. data = json.loads(data)
  28. for room in mgr.rooms:
  29. if data[1] == "join":
  30. 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$
  31. else:
  32. return Error("<b>%s</b> I couldn't find %s
  33. anywhere", user.name.title(), name.title())
  34.  
  35. i built it off these 2 commands
  36.  
  37. def broadcast(mgr, croom, user, msg, args):
  38. for room in mgr.rooms:
  39. mgr.sendObject(room, Html("Broadcast by<b>%s</b>:%s", user.name, args))
  40.  
  41. def seen(mgr, room, user, msg, args):
  42. name = args.lower().split(" ")[0]
  43. if not name.isalnum(): return Html("Non-alphanumeric name, seriously?")
  44. data = shared_db.get("seen:" + name)
  45. if data == None:
  46. return Html("I have no records about this user.")
  47. data = json.loads(data)
  48. ifdata[1] == "join":
  49. return Html("Last seen<b>%s</b> join<b>%s</b>,<b>%s</b> ago.", name, data[0], tdelta(data[2]))
  50. elif data[1] == "leave":
  51. return Html("Last seen<b>%s</b> leave<b>%s</b>,<b>%s</b> ago.", name,
  52. data[0], tdelta(data[2]))
  53. elif data[1] == "message":
  54. 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])
  55. return Html("I have no records about this user.")
  56.  
  57. as you can see i only use some of the command. it doesnt produce an error
  58. message tho.. just repeats "return Error("<b>%s</b> I couldn't find %s
  59. anywhere", user.name.title(), name.title())"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement