Merge branch 'halfwidth' into 'master'

added .halfwidth

See merge request !3
This commit is contained in:
mrhanky 2017-08-22 13:00:56 +00:00
commit c5e223a03f

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import random
import re
import irc3
from docopt import Dict as DocOptDict
@ -324,6 +325,16 @@ class Useless(DatabasePlugin):
"""
return ' '.join([self._rainbow(i, word) for i, word in enumerate(args['<words>'])])
@command
def halfwidth(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Turns UPPERCASE words into halfwidth characters
%%halfwidth <text>
"""
def halfwidth_replace(match):
return "".join(chr(0xFF20+(ord(c)-64)) for c in match.group(0))
return "[HALFWIDTH] {}".format(re.sub(r'(?:\b)[A-Z]+(?:\b)', halfwidth_replace, args.get('<word>')))
@command
def asshole(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Checks how much of an asshole you are.