Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #####################################################################################################
- # I WILL REMIND YOU, TO USE THIS IVAL COMMAND, YOU WILL NEED TO EDIT
- # YOUR CH.PY ON THIS PART:
- #
- # class Room: #IT'S NOT EXACTLY LIKE THIS, But you will know when you find somthing similiar in ch.py
- # def __init__(self, room, uid = None, server = None, port = None, mgr = None):
- # """
- # JUST BELOW def __init__(self, room, uid = None, server = None, port = None, mgr = None):
- # YOU NEED TO ADD THIS THING --> self._ivalTasks = {}
- # """
- #
- # self._ivalTasks = {} ## <<---- Yup, just add this thing
- #
- ##################################################################################################
- # if you ever feel confused even after reading the notice up ^ there , feel free to PM me (0rx)
- # GOOD LUCK !
- #################################################################################################
- if cmd == "ival":
- interval_task = room._ivalTasks #READ the instruction above regarding room._ivalTasks !!!!!
- args = args.split(" ", 1)
- if args[0] == "kill": # to kill a task - you need to do -> !ival kill TASKNAME
- if len(args) == 2:
- if args[1] in interval_task:
- self._tasks.remove(interval_task[args[1]][0])
- room.message("Task killed: "+str(args[1])+" - "+str(interval_task[args[1]][0]))
- interval_task.pop(args[1])
- if args[0] == "tasks": # To check on task list of current room - you need to do -> !ival tasks
- if len(interval_task) > 0:
- tasklist = []
- for i in interval_task:
- _task = interval_task
- tasklist.append("(Name: "+str(i)+" - (every "+str(_task[i][1])+" seconds) post "+str(_task[i][2])+" ["+str(_task[i][0])+"])")
- room.message(", ".join(tasklist))
- if args[0] not in ["kill", "tasks"]: # To create a task - you need to do -> !ival TASKNAME <time> <interval_message>
- if len(args) > 1:
- task_name = args[0]
- ivaltime, task_output = args[1].split(" ", 1)
- task_interval_time = int(ivaltime)
- task = self.setInterval(task_interval_time, room.message, str(task_output))
- interval_task.update({task_name:[task, ivaltime, task_output]})
- room.message("task created: "+str(task_name)+" ("+str(ivaltime)+" seconds interval)")
Advertisement
Add Comment
Please, Sign In to add comment