Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- elif cmd=="timeban" and len(args)>0:
- if room.getLevel(self.user) == 0:
- room.message("I'm not modded.")
- return
- if room.getLevel(user) > 0:
- try:
- #split args into name , time
- tname,timey=args.split(" ",1)
- if pars(tname) == None:
- room.message("Who the fook is "+tname+" ??")
- return
- tname = pars(tname)
- #make time string into an int
- if "-" in timey:
- room.message("Stop doing that. Please type a propper number.")
- return
- timey=int(timey)
- minute = 60
- hour = minute * 60
- day = hour * 24
- days = int(timey / day)
- hours = int((timey % day) / hour)
- minutes = int((timey % hour) / minute)
- seconds = int(timey % 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" or "hours" ) + ", "
- if len(string) > 0 or minutes > 0:
- string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes" ) + ", "
- string += str(seconds) + " " + (seconds == 1 and "second" or "seconds" )
- #banuser name
- room.banUser(ch.User(tname.lower()))
- #print message
- room.message(tname+" will be banned for : "+string+".")
- #set the unban command to the timeout time
- self.setTimeout(int(timey),room.unban,ch.User(tname.lower()))
- #set the message timeout to the bantime + 3 more seconds(just cuz)
- self.setTimeout(int(timey+1),room.message,tname.title()+" is unbanned after "+string+" period of darkness")
- except:
- #if there is an error , print the error code in the chatroom
- room.message("[ERR]Expectation Failed!!")
- else:
- room.message("Only room Owner and Moderators permitted.")
Advertisement
Add Comment
Please, Sign In to add comment