forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally ready to like add this now oh man this is a huge thing sort of
Added CC-Nanotrasen, an IRC bot made by Skibiliano and given to us by him under CC-BY-SA 3.0 licensing WHAT DOES THIS MEAN? It means all servers running this SVN now have the option to use an easy to configure IRC bot capable of relaying adminhelps from ingame to the server/channel of their choice. - Runs on python 2.6 scripts with psyco support - Relaying can be toggled from config.txt (so you don't runtime with every adminhelp if you decide not to use it) - Comes with a bunch of other useful and fun tools too - Added a new global proc, send2irc(msg,msg2) YOU'LL NEVER GUESS WHAT IT DOES CONSIDERING WHAT I JUST MENTIONED ----msg and msg2 are just what text gets relayed to irc, separated by a |, for instance send2irc(hello, world) would come out as "CC_NanoTrasen: Hello | World git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2783 316c924e-a436-60f5-8080-3fe189b3f50e
- Loading branch information
1 parent
240a9bf
commit 4472cec
Showing
33 changed files
with
5,954 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Name = "CC_NanoTrasen" #The name he uses to connect | ||
no_absolute_paths = True | ||
debug_on = False | ||
SName = ["cc","nt","trasen","nano","nanotrasen"] #Other names he will respond to | ||
DISABLE_ALL_NON_MANDATORY_SOCKET_CONNECTIONS = False | ||
directory = "c:/cc_nt/bot/" # Directory the bot is located in, make sure to keep the "/" at the end | ||
version = "TG CC-BY-SA 6" | ||
Network = 'irc.rizon.net' #e.g. "irc.rizon.net" | ||
channel = "#italiano" #what channel you want the bot in | ||
channels = ["#italiano"] #same as above | ||
greeting = "Welcome!" #what he says when a person he hasn't seen before joins | ||
prefix = "!" #prefix for bot commands | ||
Port = 7000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from random import choice as fsample #Yay for added speed! | ||
global responses | ||
responses = ['Yes','Too bad','Will you turn me off if I tell you?','Absolutely', | ||
"Not at all", "Nope", "It does", "No", "All the time", | ||
"I don't really know", "Could be","Possibly","You're still here?",# Chaoticag | ||
"No idea", "Of course", "Would you turn me off if I tell you?", | ||
"Sweet!","Nah","Certainly","Yeah","Yup","I am quite confident that the answer is Yes", | ||
"Perhaps", "Yeeeeaah... No.", "Indubitably" ] # Richard | ||
def eightball(data,debug,sender,prefix): | ||
global responses | ||
arg = data.lower().replace(prefix+"eightball ","") | ||
arg = arg.replace(prefix+"8ball ","") | ||
if debug: | ||
print sender+":"+prefix+"eightball", arg | ||
if "answer" in arg and "everything" in arg and "to" in arg: | ||
if debug: | ||
print "Responded with",42 | ||
return "42" | ||
elif arg == "derp": | ||
if debug: | ||
print "Responded with herp" | ||
return("herp") | ||
elif arg == "herp": | ||
if debug: | ||
print "Responded with derp" | ||
return("derp") | ||
else: | ||
#choice = sample(responses,1)[0] | ||
choice = fsample(responses) | ||
if debug: | ||
print "Responded with", choice | ||
return(choice) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Throws a coin, simple. | ||
from random import random | ||
def heaortai(debug,sender): return("Heads" if random() > 0.5 else "Tails") | ||
# Takes 1/6th the time of doing it with random.randint(0,1) | ||
# This file used to be a lot bigger, now it's kind of useless. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from save_load import save | ||
from os import listdir | ||
import CORE_DATA | ||
directory = CORE_DATA.directory | ||
def mkquote(prefix,influx,sender,debug): | ||
arg = influx[10+len(prefix):] | ||
if debug: | ||
print sender+":"+prefix+"makequote "+str(len(arg))+" Characters" | ||
if len(arg) == 0: | ||
return("Type something to a quote") | ||
else: | ||
files = listdir(directory+"userquotes") | ||
numb = 0 | ||
while True: | ||
numb += 1 | ||
if sender.lower()+str(numb) in files: | ||
pass | ||
else: | ||
save(directory+"userquotes/"+sender.lower()+str(numb),[arg,sender.lower()]) | ||
return("Saved as:"+sender.lower()+str(numb)) | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
### EXPERIMENTAL PROTOTYPE ### | ||
# e = 2.7182818284590452353602874713526624977572 | ||
# pi = math.pi | ||
from __future__ import division #PYTHON Y U NO TELL ME THIS BEFORE | ||
import math | ||
import random | ||
import re | ||
e = "2.7182818284590452353602874713526624977572" | ||
pi = str(math.pi) | ||
global pre | ||
pre = len("maths ") | ||
def maths(influx,prefix="!",sender="NaN",debug=True,method="n"): | ||
global pre | ||
influx = influx.lower() | ||
influx = influx[len(prefix)+pre:] | ||
influx = influx.replace("pie",pi+"*"+e) | ||
influx = influx.replace("e*",e+"*") | ||
influx = influx.replace("*e","*"+e) | ||
influx = influx.replace("pi",pi) | ||
if debug: | ||
print sender+":"+prefix+"maths" | ||
if influx.count("**") == 0 and influx.count('"') == 0 and influx.count("'") == 0 and influx.count(";") == 0 and influx.count(":") == 0: | ||
influx_low = influx.lower() | ||
influx_hi = influx.upper() | ||
if "0b" in influx_low: | ||
influx_low = re.sub("0b[0-1]*","",influx_low) | ||
influx_hi = re.sub("0B[0-1]*","",influx_hi) | ||
if "0x" in influx_low: | ||
influx_low = re.sub("0x[a-f0-9]*","",influx_low) | ||
influx_hi = re.sub("0X[A-F0-9]*","",influx_hi) | ||
if "rand" in influx_low: | ||
influx_low = re.sub("rand","",influx_low) | ||
influx_hi = re.sub("RAND","",influx_hi) | ||
if influx_low == influx_hi: | ||
influx = re.sub("rand","random.random()",influx) | ||
try: | ||
result = eval(influx.lower()) | ||
except ZeroDivisionError: | ||
return "Divide by zero detected." | ||
except SyntaxError: | ||
return "Syntax Error detected." | ||
except TypeError: | ||
return "Type Error detected." | ||
except: | ||
return "Unknown Error detected." | ||
else: | ||
if method == "n": #Normal | ||
return result | ||
elif method == "i": #Forced Int | ||
return int(result) | ||
elif method == "h": #Hex | ||
try: | ||
if "L" in hex(result)[2:]: | ||
return hex(result)[2:-1] | ||
else: | ||
return hex(result)[2:].upper() | ||
except TypeError: | ||
return "That value (%s) cannot be interpreted properly using !hmaths" %(str(result)) | ||
elif method == "b": #Binary | ||
try: | ||
return bin(result)[2:].upper() | ||
except TypeError: | ||
return "That value (%s) cannot be interpreted properly using !bmaths" %(str(result)) | ||
else: | ||
return result | ||
else: | ||
return "What are you trying to make me do again?" | ||
else: | ||
return "Those are likely to make me hang" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
global parta,partb | ||
parta = {"A":"N","B":"O","C":"P","D":"Q","E":"R","F":"S","G":"T","H":"U","I":"V","J":"W","K":"X","L":"Y","M":"Z"} | ||
partb = {'O':'B','N':'A','Q':'D','P':'C','S':'F','R':'E','U':'H','T':'G','W':'J','V':'I','Y':'L','X':'K','Z':'M'} | ||
def rot13(text): | ||
global parta,partb | ||
newtext = "" | ||
for letter in text: | ||
try: | ||
if letter.isupper(): | ||
newtext += parta[letter] | ||
else: | ||
newtext += parta[letter.upper()].lower() | ||
except: | ||
try: | ||
if letter.isupper(): | ||
newtext += partb[letter] | ||
pass | ||
else: | ||
newtext += partb[letter.upper()].lower() | ||
pass | ||
except: | ||
newtext += letter | ||
return newtext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import random | ||
def rtd(data,debug,sender): | ||
backo = data | ||
try: | ||
arg1,arg2 = backo.split("d") | ||
except ValueError, err: | ||
return("Too many or too small amount of arguments") | ||
else: | ||
if debug: | ||
print sender+":!rtd "+arg1+"d"+arg2 #faster than using %s's | ||
die,die2 = [],[] | ||
current_mark = "" | ||
outcome = 0 | ||
realnumberfound = False | ||
checks = [] | ||
count = 0 | ||
arg1 = arg1.replace(" ","") | ||
arg2 = arg2.replace(" ","") | ||
try: | ||
i_arg1 = int(arg1) | ||
a_arg1 = abs(i_arg1) | ||
if "+" in arg2 or "-" in arg2: | ||
plus_spot = arg2.find("+") | ||
minus_spot = arg2.find("-") | ||
if plus_spot == -1 and minus_spot == -1: | ||
nicer_form = "" | ||
elif plus_spot != -1 and minus_spot == -1: | ||
nicer_form = arg2[plus_spot:] | ||
elif plus_spot == -1 and minus_spot != -1: | ||
nicer_form = arg2[minus_spot:] | ||
else: | ||
if plus_spot < minus_spot: | ||
nicer_form = arg2[plus_spot:] | ||
else: | ||
nicer_form = arg2[minus_spot:] | ||
for letter in arg2: | ||
if letter == "+" or letter == "-": | ||
current_mark = letter | ||
checks = [] | ||
count += 1 | ||
continue | ||
checks.append(letter) | ||
try: | ||
next_up = arg2[count+1] | ||
except: | ||
if realnumberfound == False: | ||
i_arg2 = int("".join(checks)) | ||
checks = [] | ||
realnumberfound = True | ||
elif current_mark == "+": | ||
outcome += int("".join(checks)) | ||
else: | ||
outcome -= int("".join(checks)) | ||
else: | ||
if next_up == "+" or next_up == "-": | ||
if realnumberfound == False: | ||
i_arg2 = int("".join(checks)) | ||
checks = [] | ||
realnumberfound = True | ||
else: | ||
if current_mark == "+": | ||
outcome += int("".join(checks)) | ||
else: | ||
outcome -= int("".join(checks)) | ||
checks = [] | ||
count += 1 | ||
else: | ||
i_arg2 = int(arg2) | ||
if a_arg1 == 0 or abs(i_arg2) == 0: | ||
raise RuntimeError | ||
except ValueError: | ||
return("You lied! That's not a number!") | ||
except RuntimeError: | ||
return("Too many zeroes!") | ||
else: | ||
if a_arg1 > 100: | ||
return("Too many rolls, I can only do one hundred at max.") | ||
else: | ||
for i in xrange(0,a_arg1): | ||
if i_arg2 < 0: | ||
dice = random.randint(i_arg2,0) | ||
else: | ||
dice = random.randint(1,i_arg2) | ||
die.append(dice) | ||
die2.append(str(dice)) | ||
if i_arg2 < 0: | ||
flist = "".join(die2) | ||
else: | ||
flist = "+".join(die2) | ||
if len(flist) > 350: | ||
return(str(reduce(lambda x,y: x+y, die)+outcome)) | ||
else: | ||
if current_mark == "": | ||
return(flist+" = "+str(reduce(lambda x,y: x+y, die)+outcome)) | ||
else: | ||
return(flist+" ("+nicer_form+") = "+str(reduce(lambda x,y: x+y, die)+outcome)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from random import choice as fsample | ||
sarcastic_responses = ["Yeah right","What do I look like to you?","Are you kidding me?",#UsF | ||
"As much as you","You don't believe that yourself","When pigs fly",#UsF | ||
"Like your grandma","You would like to know, wouldn't you?", #UsF | ||
"Like your mom", #Spectre | ||
"Totally","Not at all", #Spectre | ||
"AHAHAHahahaha, No.", #Strumpetplaya | ||
"Not as much as USER","As much as USER", | ||
"Really, you expect me to tell you that?", | ||
"Right, and you've been building NOUNs for those USERs in the LOCATION, haven't you?" ] #Richard | ||
locations = ["woods","baystation","ditch"] | ||
nouns = ["bomb","toilet","robot","cyborg", | ||
"garbage can","gun","cake", | ||
"missile"] | ||
def sarcasticball(data,debug,sender,users,prefix): | ||
arg = data.lower().replace(prefix+"sarcasticball ","") | ||
arg = arg.replace(prefix+"sball ","") | ||
if debug: | ||
print sender+":"+prefix+"sarcasticball", arg | ||
choice = fsample(sarcastic_responses) | ||
if "USER" in choice: | ||
choice = choice.replace("USER",fsample(users),1) | ||
choice = choice.replace("USER",fsample(users),1) | ||
if "NOUN" in choice: | ||
choice = choice.replace("NOUN",fsample(nouns),1) | ||
if "LOCATION" in choice: | ||
choice = choice.replace("LOCATION",fsample(locations),1) | ||
if debug: | ||
print "Responded with", choice | ||
return(choice) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import random | ||
def srtd(data,debug,sender): | ||
try: | ||
arg1,arg2 = data.split("d") | ||
except ValueError, err: | ||
if str(err) == "need more than 1 value to unpack": | ||
return("Too small amount of arguments") | ||
else: | ||
return("Too many arguments") | ||
else: | ||
if debug: | ||
print sender+":!rtd "+arg1+"d"+arg2 | ||
die = [] | ||
arg1 = arg1.replace(" ","") | ||
arg2 = arg2.replace(" ","") | ||
try: | ||
i_arg1 = int(arg1) | ||
i_arg2 = int(arg2) | ||
if abs(i_arg1) == 0 or abs(i_arg2) == 0: | ||
raise RuntimeError | ||
except ValueError: | ||
return("You lied! That's not a number!") | ||
except RuntimeError: | ||
return("Too many zeroes!") | ||
else: | ||
if abs(i_arg1) > 500: | ||
return("Too many rolls, I can only do five hundred at max.") | ||
else: | ||
for i in xrange(0,abs(i_arg1)): | ||
if i_arg2 < 0: | ||
dice = random.randint(i_arg2,0) | ||
else: | ||
dice = random.randint(1,i_arg2) | ||
die.append(dice) | ||
return(str(reduce(lambda x,y: x+y, die))) |
Oops, something went wrong.