This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/munge.py

74 lines
1.2 KiB
Python
Raw Normal View History

2011-11-20 10:23:31 +01:00
# -*- coding: utf-8 -*-
from util import hook
@hook.command
def munge(inp, munge_count=0):
2012-02-28 03:03:43 +01:00
".munge <text> -- Munges up <text>."
2011-11-20 10:23:31 +01:00
reps = 0
for n in xrange(len(inp)):
rep = character_replacements.get(inp[n])
if rep:
inp = inp[:n] + rep.decode('utf8') + inp[n + 1:]
reps += 1
if reps == munge_count:
break
return inp
character_replacements = {
'a': 'ä',
2012-02-28 03:03:43 +01:00
'b': 'Б',
2011-11-20 10:23:31 +01:00
'c': 'ċ',
'd': 'đ',
'e': 'ë',
'f': 'ƒ',
'g': 'ġ',
'h': 'ħ',
'i': 'í',
'j': 'ĵ',
'k': 'ķ',
'l': 'ĺ',
2012-02-28 03:03:43 +01:00
'm': '',
2011-11-20 10:23:31 +01:00
'n': 'ñ',
'o': 'ö',
'p': 'ρ',
2012-02-28 03:03:43 +01:00
'q': 'ʠ',
2011-11-20 10:23:31 +01:00
'r': 'ŗ',
's': 'š',
't': 'ţ',
'u': 'ü',
2012-02-28 03:03:43 +01:00
'v': '',
2011-11-20 10:23:31 +01:00
'w': 'ω',
'x': 'χ',
'y': 'ÿ',
'z': 'ź',
'A': 'Å',
'B': 'Β',
'C': 'Ç',
'D': 'Ď',
'E': 'Ē',
2012-02-28 03:03:43 +01:00
'F': '',
2011-11-20 10:23:31 +01:00
'G': 'Ġ',
'H': 'Ħ',
'I': 'Í',
'J': 'Ĵ',
'K': 'Ķ',
'L': 'Ĺ',
'M': 'Μ',
'N': 'Ν',
'O': 'Ö',
'P': 'Р',
2012-02-28 03:03:43 +01:00
'Q': '',
2011-11-20 10:23:31 +01:00
'R': 'Ŗ',
'S': 'Š',
'T': 'Ţ',
'U': 'Ů',
2012-02-28 03:03:43 +01:00
'V': '',
2011-11-20 10:23:31 +01:00
'W': 'Ŵ',
'X': 'Χ',
'Y': '',
2012-02-29 09:29:53 +01:00
'Z': 'Ż'}