moar PEP8
This commit is contained in:
parent
9f0bcbbac5
commit
715f926846
5 changed files with 69 additions and 66 deletions
|
@ -123,7 +123,8 @@ def kick(inp, input=None, notice=None):
|
||||||
@hook.command
|
@hook.command
|
||||||
def say(inp, input=None, notice=None):
|
def say(inp, input=None, notice=None):
|
||||||
".say [channel] <message> -- Makes the bot say <message> in [channel]. "\
|
".say [channel] <message> -- Makes the bot say <message> in [channel]. "\
|
||||||
"If [channel] is blank the bot will say the <message> in the channel the command was used in."
|
"If [channel] is blank the bot will say the <message> in "\
|
||||||
|
"the channel the command was used in."
|
||||||
if not input.nick in input.bot.config["admins"]:
|
if not input.nick in input.bot.config["admins"]:
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -146,8 +147,9 @@ def say(inp, input=None, notice=None):
|
||||||
@hook.command("me")
|
@hook.command("me")
|
||||||
@hook.command
|
@hook.command
|
||||||
def act(inp, input=None, notice=None):
|
def act(inp, input=None, notice=None):
|
||||||
".act [channel] <action> -- Makes the bot act out <action> in [channel]. "
|
".act [channel] <action> -- Makes the bot act out <action> in [channel] "\
|
||||||
\"If [channel] is blank the bot will act the <action> in the channel the command was used in."
|
"If [channel] is blank the bot will act the <action> in "\
|
||||||
|
"the channel the command was used in."
|
||||||
if not input.nick in input.bot.config["admins"]:
|
if not input.nick in input.bot.config["admins"]:
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,7 +6,8 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def choose(inp):
|
def choose(inp):
|
||||||
".choose <choice1>, [choice2], [choice3], [choice4], ... -- Randomly picks one of the given choices."
|
".choose <choice1>, [choice2], [choice3], [choice4], ... -- "\
|
||||||
|
"Randomly picks one of the given choices."
|
||||||
|
|
||||||
c = re.findall(r'([^,]+)', inp)
|
c = re.findall(r'([^,]+)', inp)
|
||||||
if len(c) == 1:
|
if len(c) == 1:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from util import hook
|
from util import hook
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
# used for tails: x heads: y
|
# used for tails: x heads: y
|
||||||
def flip_simple(count):
|
def flip_simple(count):
|
||||||
heads = 0
|
heads = 0
|
||||||
|
@ -18,8 +19,8 @@ def flip_simple(count):
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def coin(inp):
|
def coin(inp):
|
||||||
".coin [amount] -- Flips [amount] of coins."
|
".coin [amount] -- Flips [amount] of coins."
|
||||||
|
# checking for valid input. if valid input [count=inp],
|
||||||
# checking for valid input. if valid input [count=inp], if invalid [return error], if no input [count=1]
|
# if invalid [return error], if no input [count=1]
|
||||||
if inp.isdigit():
|
if inp.isdigit():
|
||||||
count = int(inp)
|
count = int(inp)
|
||||||
else:
|
else:
|
||||||
|
@ -40,5 +41,5 @@ def coin(inp):
|
||||||
return "You flip a coin and get " + sidename + "."
|
return "You flip a coin and get " + sidename + "."
|
||||||
else:
|
else:
|
||||||
flips = flip_simple(count)
|
flips = flip_simple(count)
|
||||||
return "You flip %s coins and get %s heads and %s tails." % (str(count), str(flips[0]), str(flips[1]))
|
return "You flip %s coins and get "\
|
||||||
|
"%s heads and %s tails." % (str(count), str(flips[0]), str(flips[1]))
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
from util import hook
|
from util import hook
|
||||||
|
|
||||||
|
|
||||||
# CTCP responses
|
# CTCP responses
|
||||||
@hook.regex(r'^\x01VERSION\x01$')
|
@hook.regex(r'^\x01VERSION\x01$')
|
||||||
def ctcpversion(inp, notice=None):
|
def ctcpversion(inp, notice=None):
|
||||||
notice('\x01VERSION: CloudBot - http://git.io/cloudbot')
|
notice('\x01VERSION: CloudBot - http://git.io/cloudbot')
|
||||||
|
|
||||||
|
|
||||||
@hook.regex(r'^\x01PING\x01$')
|
@hook.regex(r'^\x01PING\x01$')
|
||||||
def ctcpping(inp, notice=None):
|
def ctcpping(inp, notice=None):
|
||||||
notice('\x01PING: PONG')
|
notice('\x01PING: PONG')
|
||||||
|
|
||||||
|
|
||||||
@hook.regex(r'^\x01TIME\x01$')
|
@hook.regex(r'^\x01TIME\x01$')
|
||||||
def ctcptime(inp, notice=None):
|
def ctcptime(inp, notice=None):
|
||||||
notice('\x01TIME: GET A WATCH')
|
notice('\x01TIME: GET A WATCH')
|
||||||
|
|
||||||
|
|
||||||
@hook.regex(r'^\x01FINGER\x01$')
|
@hook.regex(r'^\x01FINGER\x01$')
|
||||||
def ctcpfinger(inp, notice=None):
|
def ctcpfinger(inp, notice=None):
|
||||||
notice('\x01FINGER: WHERE ARE YOU PUTTING THAT')
|
notice('\x01FINGER: WHERE ARE YOU PUTTING THAT')
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
'''
|
'''
|
||||||
Plugin which (de)cyphers a string
|
Plugin which (de)cyphers a string
|
||||||
|
|
||||||
Doesn't cypher non-alphanumeric strings yet.
|
Doesn't cypher non-alphanumeric strings yet.
|
||||||
|
|
||||||
by instanceoftom
|
by instanceoftom
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -10,6 +8,7 @@ from util import hook
|
||||||
chars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
chars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
||||||
len_chars = len(chars)
|
len_chars = len(chars)
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def cypher(inp):
|
def cypher(inp):
|
||||||
".cypher <pass> <string> -- Cyphers <string> with <password>."
|
".cypher <pass> <string> -- Cyphers <string> with <password>."
|
||||||
|
@ -34,9 +33,9 @@ def cypher(inp):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
out += character
|
out += character
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def decypher(inp):
|
def decypher(inp):
|
||||||
".decypher <pass> <string> -- Decyphers <string> with <password>."
|
".decypher <pass> <string> -- Decyphers <string> with <password>."
|
||||||
|
@ -45,10 +44,7 @@ def decypher(inp):
|
||||||
len_passwd = len(passwd)
|
len_passwd = len(passwd)
|
||||||
inp = " ".join(inp.split(" ")[1:])
|
inp = " ".join(inp.split(" ")[1:])
|
||||||
|
|
||||||
|
|
||||||
passwd_index = 0
|
passwd_index = 0
|
||||||
#I am lazy and I could do the math to get the passwd_index
|
|
||||||
#for this inp, but meh thats for a later day so lets loop.
|
|
||||||
for character in inp:
|
for character in inp:
|
||||||
try:
|
try:
|
||||||
chr_index = chars.index(character)
|
chr_index = chars.index(character)
|
||||||
|
|
Reference in a new issue