~aleteoryx/ntalk

32c9d4becb3c6f119aad7e048b8c002a49bd464a — Aleteoryx a month ago b9b0652
better errors
2 files changed, 7 insertions(+), 3 deletions(-)

M botlib.py
M dee.py
M botlib.py => botlib.py +1 -1
@@ 112,7 112,7 @@ def parse_words(line):

def readln():
	global isok
	return isok.readline().decode('latin-1').strip()
	return isok.readline().decode('latin-1', errors='replace').strip()

def readk():
	return int(readln())

M dee.py => dee.py +6 -2
@@ 14,6 14,10 @@ def send(msg):
	global NAME
	botlib.send(f'{NAME}: {msg}')

def act(what):
	global NAME
	botlib.send(f'{NAME} {msg}')

def help(nick):
	send(f'{nick}, my commands are: "dee, roll <dice>", "dee, shuf[fle] <A>, <B>, and <C>", and "dee, pick <A>, <B>, or <C>"')



@@ 136,14 140,14 @@ def parse_dice(nick, words):
		try:
			offset = parse_number(words[1])
		except (IndexError, ValueError):
			raise DiceParseException(f'{words[0]} what?')
			raise DiceParseException(f'roll {count} d{last_dice} {words[0]} what?')
		
		if words[0] not in ('plus', 'add', '+'):
			offset *= -1
	
		return count, last_dice, offset

	raise DiceParseException(f'what?')
	raise DiceParseException(f'roll what?')

def dice(nick, words, pwords):
	result = nick