Introduction
Introduction Statistics Contact Development Disclaimer Help
Add flipping service to annna. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 401434bbb4ce0b5cee4c9f6de913c9ba1f729005
parent e3fce34e15750097f2bff69afb5ac5c7512f0c55
Author: Annna Robert-Houdin <[email protected]>
Date: Sun, 29 Nov 2020 15:28:42 +0100
Add flipping service to annna.
Diffstat:
M annna-start-services | 5 +++++
A updown | 88 +++++++++++++++++++++++++++++…
2 files changed, 93 insertions(+), 0 deletions(-)
---
diff --git a/annna-start-services b/annna-start-services
@@ -351,6 +351,11 @@ annna_common() {
word="$(printf "%s\n" "${text}" | cut -c 21-)"
annna-say -c "${channel}" "${word}, pew pew."
;;
+ "${botname}, please flip "*)
+ word="$(printf "%s\n" "${text}" | cut -c 20-)"
+ updownword="$(updown "${word}")"
+ annna-say -c "${channel}" "${word} -> ${updownword}"
+ ;;
"${botname}, please give me a good band name.")
bandname="$(bandname-gen | shuf | head -n 1)"
annna-say -c "${channel}" "${bandname}"
diff --git a/updown b/updown
@@ -0,0 +1,88 @@
+#!/usr/bin/env python2
+# coding=utf-8
+#
+# Original credits to: http://www.weechat.org/scripts/source/stable/upside_dow…
+#
+# Copy me if you can.
+# by 20h
+#
+
+import sys
+import re
+
+replacements = {
+ u'A' : u'\N{FOR ALL}',
+ u'B' : u'\N{GREEK SMALL LETTER XI}',
+ u'C' : u'\N{ROMAN NUMERAL REVERSED ONE HUNDRED}',
+ u'D' : u'\N{LEFT HALF BLACK CIRCLE}',
+ u'E' : u'\N{LATIN CAPITAL LETTER REVERSED E}',
+ u'F' : u'\N{TURNED CAPITAL F}',
+ u'G' : u'\N{TURNED SANS-SERIF CAPITAL G}',
+ u'J' : u'\N{LATIN SMALL LETTER LONG S}',
+ u'K' : u'\N{RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT}',
+ u'L' : u'\ua780',
+ u'M' : u'W',
+ u'N' : u'\N{LATIN LETTER SMALL CAPITAL REVERSED N}',
+ u'P' : u'\N{CYRILLIC CAPITAL LETTER KOMI DE}',
+ u'Q' : u'\N{GREEK CAPITAL LETTER OMICRON WITH TONOS}',
+ u'R' : u'\N{LATIN LETTER SMALL CAPITAL TURNED R}',
+ u'T' : u'\N{UP TACK}',
+ u'U' : u'\N{INTERSECTION}',
+ u'V' : u'\u0245',
+ u'Y' : u'\N{TURNED SANS-SERIF CAPITAL Y}',
+ 'a' : u"\u0250",
+ 'b' : u'q',
+ 'c' : u"\u0254",
+ 'd' : u'p',
+ 'e' : u"\u01DD",
+ 'f' : u"\u025F",
+ 'g' : u"\u0183",
+ 'h' : u'\u0265',
+ 'i' : u'\u0131',
+ 'j' : u'\u027E',
+ 'k' : u'\u029E',
+ 'm' : u'\u026F',
+ 'n' : u'u',
+ 'r' : u'\u0279',
+ 't' : u'\u0287',
+ 'p' : u'd',
+ 'u' : u'n',
+ 'q' : u'b',
+ 'v' : u'\u028C',
+ 'w' : u'\u028D',
+ 'y' : u'\u028E',
+ '.' : u'\u02D9',
+ '[' : u']',
+ '(' : u')',
+ '{' : u'}',
+ '?' : u'\u00BF',
+ '!' : u'\u00A1',
+ "\'" :u',',
+ '>' : u'<',
+ '<' : u'>',
+ '_' : u'\u203E',
+ ';' : u'\u061B',
+ '\u203F' : u'\u2040',
+ '\u2045' : u'\u2046',
+ '\u2234' : u'\u2235',
+}
+
+def main(args):
+ if len(args) < 2:
+ sys.stderr.write("usage: %s text\n" % (args[0]))
+
+ ostr = " ".join(args[1:])
+ istr = ""
+ for i in ostr:
+ try:
+ istr += replacements[i]
+ except:
+ istr += i
+
+ istr = istr.encode("utf-8")
+ print istr
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
+
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.