Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import sys
- import random
- import imp
- import math
- import threading
- import json
- import re
- import urllib
- import os
- import urllib
- import codecs
- import datetime
- from xml.etree import cElementTree as ET
- if sys.version_info[0] > 2:
- import urllib.request as urlreq
- else:
- import urllib2 as urlreq
- ##Variables##
- name = ''
- timeout = 0
- ##Funcs##
- def tformat(args):
- minute = 60
- hour = minute * 60
- day = hour * 24
- days = int(args / day)
- hours = int((args % day) / hour)
- minutes = int((args % hour) / minute)
- seconds = int(args % 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")
- return (string)
- def timer():
- global timeout
- while timeout > 0:
- if time.time() > timeout:
- print("Timer is up! DRIIING!!! DRIIING!!! DRIIING!!!")
- timeout = 0
- def kick():
- while True:
- try:
- global name
- global timeout
- term = input("Node: ")
- if term == "hi":
- print("Hi there !! :D")
- if "fuck" in term.lower():
- print("Yesssshhhh t['~']_, "+term)
- if term.lower() in name and not term.lower() == "":
- print("Nan desu ka ?")
- if term[0] == "!":
- data = term[1:].split(" ", 1)
- if len(data) > 1:
- node, args = data[0], data[1]
- else:
- node, args = data[0], ""
- ##Core Node##
- if node == "eval" or node == "ev":
- ret = repr(eval(args))
- print(ret)
- if node == "kill":
- print("Bye bye master :)")
- return
- ##Core Node end##
- ##Simple Nodes##
- if node == "setname":
- name = args
- print("changed to "+args)
- if node == "name":
- if " " in name:
- tname = name.split(" ", 1)
- output = random.choice(["Given "+tname[0].title()+" as my last name, and "+tname[1].title()+" be my first name. Yoroshiku onegaishimasu *Bows down*", ""+tname[0].title()+" be my last name, and given "+tname[1].title()+" as my first name. Yoroshiku onegaishimasu *Bows down*"])
- print(output)
- else:
- print("Atashi no namae wa "+name.title()+" desu. Yoroshiku ne ;)")
- if node == "say":
- if args == "":
- print("*Silent*")
- else:
- print(args)
- if node == "rsay":
- if args == "":
- print("what should I say"[::-1])
- else:
- print(args[::-1])
- ##Simple Nodes end##
- ##Basic Nodes##
- if node == "timeset" and len(args) > 1:
- sec = 0
- mnt = 0
- hr = 0
- if "s" in args:
- ss = args.split("s", 1)
- sec = int(ss[1].split(" ", 1)[0])
- elif "m" in args:
- mm = args.split("m", 1)
- mnt = int(mm[1].split(" ", 1)[0])
- elif "h" in args:
- h = args.split("h", 1)
- hr = int(h[1].split(" ", 1)[0])
- mnt_sec = mnt * 60
- hr_sec = hr * 3600
- args = sec + hr_sec + mnt_sec
- timeout = time.time() + args
- string = tformat(args)
- stime = threading.Thread(target=timer)
- stime.daemon = True
- stime.start()
- print("Timer set is set to ring in: "+string)
- if node == "timeleft":
- if timeout > 0:
- stf = timeout - time.time()
- string = tformat(stf)
- print(string+" left.")
- else:
- print("No timer has been set")
- ##Basic Nodes end##
- ##Complicated Nodes##
- except KeyboardInterrupt:
- print("I can't live any longer master D: *commits suicide*")
- break
- except Exception as e:
- et, ev, tb = sys.exc_info()
- lineno = tb.tb_lineno
- fn = tb.tb_frame.f_code.co_filename
- print("[Expectation Failed] %s Line %i - %s"% (fn, lineno, str(e)))
- if __name__ == "__main__":
- kick()
Advertisement
Add Comment
Please, Sign In to add comment