• Pagina 1 din 1
  • 1
Comunitatea uCoz » Configurări ale sistemului uCoz » Mini-chat » Mini-chat/ chatango bot (Mini-chat/ chatango bot)
Mini-chat/ chatango bot
Fenomenul-thephenom
Postări: 52
Reputație: 1
Mesaj # 1 | 12:13 PM
1. Salut, m-am gandit sa va intreb daca se poate creea un bot pentru mini-chatul din ucoz , ce as vrea sa faca acest bot , as vrea ca botul sa puna o serie de intrebari la un anumit interval de timp, acele intrebari sa contina puncte iar userul cand raspunde corect respectivele puncte sa i-se adauge la reputatie .

2. Daca nu se poate face un asemenea chat pe mini-chatul din ucoz poate e posibil unul asemanator pe chatango, cu ajutorul softului Python 3.4 GUI , am reusit sa creez un bot pentru chatango, ce as vrea sa faca botul este la fel sa puna o serie de intrebari si userul care a raspuns sa scrie ,,numele userului,, a raspuns corect . c-am atat , voi lasa mai jos un video si intregul cod al botuui , si poate reuseste cineva experimentat sa-l programeze sa puna anumite intrebari.
P.S stiu ca nu e treaba baietilor de la ucoz sa se ocupe de asta , ci doar de probleme in cazul platformei lor, dar nu stiu la cine sa apelez si m-am gandit sa scriu aici poate ma ajuta cineva cu una dintre cele doua varinate

http://www.youtube.com/watch?v=4AIPrUdFe2o

Cod
# This is a free to use chatango bot by TryHardHusky.
# www.tryhardhusky.chatango.com
# If you would like help setting up your own bot, feel free to send me a personal message on chatango.

# YOU WILL NEED THE CH.PY TO RUN THIS BOT!
# YOU CAN GET IT FROM HERE http://pastebin.com/npig5Np4

#imports
import ch
import random
import sys
import os
import re
import cgi
import traceback
import time
import urllib
import datetime
import binascii
import json
from xml.etree import cElementTree as ET
#end imports

prefix = "#"

owners = ['ThePhenom007']   #Put your chatango name here
error = ("Oops. Something went wrong D:")    #Error message

#setting colors

class UcogiBot(ch.RoomManager):
    def onInit(self):
      self.setNameColor("0000f7")
      self.setFontColor("7007ad")
      self.setFontFace("1")
      self.setFontSize(13)
      self.enableBg()    
      self.enableRecording()

#connecting and disconnecting crap

    def onConnect(self, room):
      print("[+] Connected to "+room.name)

    def onReconnect(self, room):
      print("[+] Reconnected to "+room.name)
      
    def onDisconnect(self, room):
      print("[+] Disconnected from "+room.name)

#setting up commands

    def onMessage(self, room, user, message):
      print(room.name + " - " + user.name + ": " + message.body)
      if self.user == user: return
      if message.body[0] == "!":
        data = message.body[1:].split(" ", 1)
        if len(data) > 1:
          cmd, args = data[0], data[1]
        else:
          cmd, args = data[0], ""

#on flood warning, reconnect
            
    def onFloodWarning(self, room):
      print("[INFO] FLOOD WARNING")
      room.reconnect()
     
#on user count change print to console
        
    def onUserCountChange(self, room):
       print("users: " + str(room.usercount)+"- Roomname: "+room.name)
       #room.message("The chatroom user count has changed USERS: "+ str(room.usercount))
     
#onMod add
         
    def onModAdd(self, room, user):
      print("[INFO]  MOD ADDED :"+user.name.capitalize()+" ^_^")
      try:
        room.message("Sorry to disturb but , "+user.name.capitalize()+", was added to the mod list.They must love you in this chat *h* ")
      except:
        print("[EXCEPTION]failed on mod add")
     
#onMod remove
          
    def onModRemove(self, room, user):
      print("[INFO]  MOD REMOVED :"+user.name.capitalize())
      try:
        room.message("Hey sorry to disturb , but "+user.name.capitalize()+" was removed from the mod list...-_-")
      except:
        print("[EXCEPTION]failed on mod add")
     
#onBan
          
    def onBan(self, room, user, target):
      print("[INFO]A USER HAS BEEN BANNED : "+target.name.capitalize()+" BANNED BY : "+user.name)
      try:
        room.message("Hey guys... I noticed some dickhead was banned. His name is "+target.name.capitalize()+" .Banned by "+user.name+". I don't blame him..")
      except:
        print("[EXCEPTION] ONBAN FAILED")
     
#on unban
          
    def onUnban(self, room, user, target):
      print("[INFO]A USER HAS BEEN UNBANNED : "+target.name.capitalize()+" UNBANNED BY : "+user.name)
      try:
        room.message("Hey guys... I noticed someone was given a second chance and was unbanned. His name is "+target.name.capitalize()+" . Unbanned by "+user.name+". Be good ok? For me?")
      except:
        print("[EXCEPTION] ON UNBAN FAILED")
     
    def onPMConnect(self, pm):
     
      print("connected to pms")
     
         
    def onPMDisconnect(self, pm):
     
      output = "Disconnected from private chat.UcogiBot"          
      print(output)
         
    def onPMMessage(self, pm, user, body):
      pass
           
    def onPMOfflineMessage(self, pm, user, body):
      pass
     
    ### Get user access from the file, and retun lvl of access number            
    def getAccess(self, user):
      if user.name in spermitted: return 4 # owner-JP
      elif user.name in permitted: return 3 # masters
      elif user.name in hpermitted: return 2 # half-masters
      elif user.name in whitelist: return 1 # White-list
      else: return 0

#commands section

      if cmd == "test":
          room.message("Test Worked")

#bot activation and deactivatin code#########################    
      # call bot name, activate if deactivated (bot)
      if (cmd == room.user.name or cmd =="UcogiBot" or cmd =="Ucogi") and len(args) == 0:
        if not activated and self.getAccess(user) < 2: return
        responce = [" *h*+25 Hello =^_^= " , " *h* , Hi "+user.name]#, "How may I help you?","Hey love *h* ","HI  =^.^="]
        room.message(random.choice(responce))
        activated = True          
            
#extra crap

    def onUserCountChange(self, room):
      print("Users: " + str(room.usercount))

    def onFloodWarning(self, room):
      room.reconnect()
      print("[+] Reconnecting...")

    def onPMMessage(self, pm, user, body):
      print("PM - "+user.name+": "+body)
      pm.message(user, "Please talk to my owner, CHATANGO_NAME, Instead!")

if __name__ == "__main__":
          UcogiBot.easy_start()

Siteul meu http://cartoons.ucoz.ro
Material modificat de Fenomenul-thephenom - Sâmbătă, 15/11/2014, 12:14 PM
Joe
Postări: 771
Reputație: 41
Mesaj # 2 | 1:07 PM
Fenomenul-thephenom, nu poţi face niciuna dintre lucrurile dorite, cel puţin nu fără PHP.

Citat Fenomenul-thephenom ()
cu ajutorul softului Python 3.4 GUI , am reusit sa creez un bot pentru chatango

Nu poţi executa fişiere .py în sistemul uCoz.
Fenomenul-thephenom
Postări: 52
Reputație: 1
Mesaj # 3 | 3:01 PM
am înțeles bigblog mersi de răspuns!
Siteul meu http://cartoons.ucoz.ro
Comunitatea uCoz » Configurări ale sistemului uCoz » Mini-chat » Mini-chat/ chatango bot (Mini-chat/ chatango bot)
  • Pagina 1 din 1
  • 1
Căutare: