Chatango bot commands

Chatango bot commands


    ############################################################################
    ############################################################################
    ####    Getting Started Bot                                     ############
    ####    File            = ExampleBot.py                         ############    
    ####    Originaly by    = clonerxyz                             ############
    ####    Edited by       = Thelorgorenk                          ############
    ####    you can PM for info about making a chatango             ############
    ####    bot in http://thelorgorenk.chatango.com, and you can    ############
    ####    and you can also chat in :                              ############
    ####            http://khususme.chatango.com                    ############
    ####    Last update:                                            ############
    ####            3.21 AM August, 1 2015 by Thelorgorenk          ############
    ############################################################################
    ############################################################################
    ##Importing Random Crap xD
    #here you can see that you're importing ch library
     
    import ch
    import random
    import sys
    import json
    import time
    import re
    if sys.version_info[0] > 2:
      import urllib.request as urlreq
    else:
      import urllib2 as urlreq
    from time import localtime, strftime
    wordtodaytime = dict()
    ##Dance moves!
    #kinda useless
     
    dancemoves = [
      "(>^.^)>",
      "(v^.^)v",
    ]
    song = [
      "Dirimu, dirimulah! Orang yang beriku senyum ini",
    "Jika kita bisa membuat air mata yang bersinar, itu 'kan 'jadi bintang jatuh",
    "Tanganmu t'lah terluka, tapi jangan pernah lepaskannya lagi",
    "Dari langit yang terpenuhi keinginan, hari esok 'kan segera datang",
     
    "Cahya yang membimbingku adalah dirimu",
    "Dan aku pun ditarik karenanya",
    "Sebelum kusadarim kita mulai sebrangi jalan itu",
    "Sekaranglah saatnya! Jikalau kita hanya bisa bersinar di sini",
    ]
     
    bete = [
    "kunci",
    ]
    pagi = [
    "ohayou oni-chan",
    ]
     
    # implied command?     
    # call bot name with command after
    # call bot name with command after
    #Setting Pretty Colors
    #Font setting for your bot
     
    class TestBot(ch.RoomManager):
      def onInit(self):
        self.setNameColor("F9F")
        self.setFontColor("F33")
        self.setFontFace("1")
        self.setFontSize(13)
        self.enableBg()
        self.enableRecording()
    ##### Pars Def
      def pars(args):
              args=args.lower()
              userlist = roomUsers()
              for name in userlist:
                if args in name:return name  
    ##Connecting Crap
    #This is what will be printed on your python console when event called
     
      def onConnect(self, room):
        print("Connected")
     
      def onReconnect(self, room):
        print("Reconnected")
     
      def onDisconnect(self, room):
        print("Disconnected")
     
     
    ##Ignore this, you dont need to worry about this
    #Well, you can actually take a little time to look at it and learn something
      def onMessage(self, room, user, message):
      #### Comenzi fara prefix
       if message.body.startswith("test"):
         room.message("Test request granted :v")
       if message.body.startswith("woi"):
         room.message("Apa njay? :v :)")
       if message.body.startswith("sepi"):
         room.message("I'am here. :)")
       if message.body.startswith("siang"):
         room.message("Hello, siang :)")
       if message.body.startswith("malam"):
         room.message("Hello, malam :)")
       if message.body.startswith("konbanwa"):
         room.message("Hello, konbanwa")
       if message.body.startswith("oyasumi"):
         room.message("Hello, oyasumi :v")
       if message.body.startswith("konichiwa"):
         room.message("Hello, konichiwa :)")
       if message.body.startswith("jam"):
          room.message(strftime("%H:%M:%S", localtime()))      
       if message.body.startswith("tanggal"):
         room.message(strftime ("HARI: %a,%d-%b-%Y ", localtime()))
       if message.body.startswith("siapa yang "):
         room.message(random.choice(room.usernames))
       if message.body.startswith("lol"):
         room.message("Yea lol  @"+user.name+".")
         room.message(random.choice(jawab)+" @"+user.name)
    ##COMMANDS!
    #Setting up commands for yer bot
     #commands section
    #### Invite
          if cmd == "invite" or cmd == "Invite":
            if len (args) > 0:
                self.pm.message(ch.RoomManager(args),"%s You have a group invite by ! http://%s.chatango.com ." %(owners[0],room.name))
                room.message("Invite on progress %s in Access group. :)" % args)
            else:
                room.message("Sry have problem. :3")
    ##You may want/need to evaluate something about your bot.
          if cmd == "ev" or cmd == "eval" or cmd == "e":
              ret = eval(args)
              if ret == None:
                room.message("Done.")
                return
              room.message(str(ret))
         
            ##Say
            #Make your bot say what you want
     
          elif cmd == "afk":
            jawab = ["See u"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "crunch":
            jawab = ["https://31.media.tumblr.com/50dcec4f797eb86ea483558695c874f1/tumblr_nqru66BNYc1u8lwqgo1_500.gif"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "nja":
            jawab = ["Njaa ne ^^"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "coeghd":
            jawab = ["anda kenapa?"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == ":v":
            jawab = ["emoticon dewa"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "lebaran":
            jawab = ["minal aidzin wal faizin kk"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "gue tamvan gak ?":
            jawab = ["kaga","tamvan","jelek","biasa aja"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "hmm":
            jawab = ["maho detcted"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "konbanwa":
            jawab = ["tidur sana jangan ngalong :v"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "naruto":
            jawab = ["adalah anime yang selalu flash back"]
            room.message(random.choice(jawab)+" @"+user.name)
          elif cmd == "bnp":
            jawab = ["erorr forbidden access denied"]
            room.message(random.choice(jawab)+" @"+user.name)
            ##Random User
            #What's this for ? this one cmd will make your boy say the name of a random user in a room
          if cmd == "randomuser":
            room.message(random.choice(room.usernames))
     
            ##Check Level
            #This one cmd is tho make your bot say your mod level in the current room you're in
          elif cmd == "mylvl":
            room.message("Your mod level: %i" %(room.getLevel(user)))
     
            ##List Mods
            #List of Mods and Owner name in the current room you're in
          elif cmd == "mods":
            room.message(", ".join(room.modnames + [room.ownername]))
            #### Seen
          elif cmd == "invitegroup" or cmd == "ig":
            if len (args) > 0:
             self.pm.message(ch.RoomManager(args),"%s You have group invite! check this Chatango Group http://%s.chatango.com ." %(room.ownername[0],room.name))
             room.message("Youre invite %s now is in Accest Group. :)" % args)
            else:
              room.message("gak mau ah nginvite dia")
            ##DANCE!!!!
            #Dance ? Of Course !!! ^_^
          elif cmd == "dance":
            for i, msg in enumerate(dancemoves):
              self.setTimeout(i / 2, room.message, msg)
                   #### Pm
          elif cmd == "pm" or cmd == "Pm" or cmd == "PM" or cmd == "Private Message":
            data = args.split(" ", 1)
            if len(data) > 1:
              name , args = data[0], data[1]
              self.pm.message(ch.User(name), "[Private.Message] By - "+user.name+" : "+args+" ")
              room.message("Has been sent to "+name+"")
            #### Invite
          elif cmd == "invite" or cmd == "Invite":
            if len (args) > 0:
                self.pm.message(ch.RoomManager(args),"%s You have a group invite by ! http://%s.chatango.com ." %(owners[0],room.name))
                room.message("Invite on progress %s in Access group. :)" % args)
            else:
                room.message("Sry have problem. :3")
            #### Profile
          elif cmd == "prof" or cmd == "profile" or cmd == "Prof" or cmd == "Profile":
            try:
              args=args.lower()
              stuff=str(urlreq.urlopen("http://"+args+".chatango.com").read().decode("utf-8"))
              crap, age = stuff.split('<span class="profile_text"><strong>Age:</strong></span></td><td><span class="profile_text">', 1)
              age, crap = age.split('<br /></span>', 1)
              crap, gender = stuff.split('<span class="profile_text"><strong>Gender:</strong></span></td><td><span class="profile_text">', 1)
              gender, crap = gender.split(' <br /></span>', 1)
              if gender == 'M':
                  gender = 'Male'
              elif gender == 'F':
                  gender = 'Female'
              else:
                  gender = '?'
              crap, location = stuff.split('<span class="profile_text"><strong>Location:</strong></span></td><td><span class="profile_text">', 1)
              location, crap = location.split(' <br /></span>', 1)
              crap,mini=stuff.split("<span class=\"profile_text\"><!-- google_ad_section_start -->",1)
              mini,crap=mini.split("<!-- google_ad_section_end --></span>",1)
              mini=mini.replace("<img","<!")
              picture = '<a href="http://fp.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/full.jpg" style="z-index:59" target="_blank">http://fp.chatango.com/profileimg/' + args[0] + '/' + args[1] + '/' + args + '/full.jpg</a>'
              prodata = '<br/> <a href="http://chatango.com/fullpix?' + args + '" target="_blank">' + picture + '<br/><br/> Age: '+ age + ' <br/> Gender: ' + gender +  ' <br/> Location: ' +  location + '' '<br/> <a href="http://' + args + '.chatango.com" target="_blank"><u>Chat With User</u></a> ' "<br/><br/> "+ mini
              room.message(prodata,True)
            except:
              room.message(""+args+" doesn't exist o.o ")
            #
            if cmd =="wordtoday" or cmd=="wt":
                if user.name in owners:
                  if user.name in wordtodaytime:
                    w = json.loads(wordtodaytime[user.name])
                    if time.time() < w:
                      w = int(w) - int(time.time())
                      minute = 60
                      hour = minute * 60
                      day = hour * 24
                      days =  int(w / day)
                      hours = int((w % day) / hour)
                      minutes = int((w % hour) / minute)
                      seconds = int(w % minute)
                      string = ""
                      if days > 0:
                        string += str(days) + " " + (days == 1 and "day" or "days" ) + ", "
                      if len(string) > 0 or hours > 0:
                        string += str(hours) + " " + (hours == 1 and "hour

1 comment: