async def owo(self, ctx, *, msg: commands.clean_content = None): """Converts normal text to OwO Usage: !owo 'text' If no text is provided, it uses the previous message's contents""" if not msg: msg = ctx.bot._connection._messages[ len(ctx.bot._connection._messages) - 2].content owo_msg = owo.text_to_owo(msg) await ctx.send(owo_msg)
def pretty_translate(text_to_translate: str, language_to: str, language_from: str = None): if language_to.lower() == "owo" or language_to.lower() == "uwu": return text_to_owo(text_to_translate) elif language_to.lower() == "clap": return text_to_clap(text_to_translate) elif language_to.lower() == "yell" or language_to.lower() == "yelling": return text_to_translate.upper() elif language_to.lower() == "pasta" or language_to.lower() == "emojipasta": return text_to_pasta(text_to_translate) else: return "Translation function deactivated for now"
async def owo(self, ctx): """ Escribe lo que quieras al usar este comando para que lo owofique. """ comand = ["nya>owo", ">>owo", "nya", "owo", "@SatanyaBot"] owo = ctx.message.content new_owo = owo.split() final_owo = [word for word in new_owo if word not in comand] final_owo = " ".join(final_owo) send_final_owo = (text_to_owo(final_owo)) await ctx.send(send_final_owo) await ctx.message.delete( ) #El bot elimina el mensaje del comando enviado por el usuario
def get_str(ctx, cmd, bot=None, can_owo=True): """Funct to get answers from i18n folder.""" lang = 'english' weeb = False if isinstance(ctx, commands.context.Context) and ctx.guild: gid = ctx.guild.id bot = ctx.bot lang = bot.languages_map.get(gid, 'english') weeb = bot.owo_map.get(gid, False) texthelp = "" elif isinstance(ctx, discord.Guild): gid = ctx.id if bot: lang = bot.languages_map.get(gid, 'english') weeb = bot.owo_map.get(gid, False) else: bot = ctx.bot if bot.loaded_languages: lang = [l for l in bot.loaded_languages if l.lower() == lang] if lang: lang = lang[0] else: lang = 'english' current_lang = bot.loaded_languages[lang] else: current_lang = no_lang_loaded try: text = current_lang[cmd] except KeyError: try: text = no_lang_loaded[cmd] except KeyError: # I didn't translated the help for weeb commands. if 'Weeb' not in bot.cogs or (cmd.split("-")[1] not in [ g.name for g in bot.cogs['Weeb'].get_commands() ]): log.error(f"TranslationError {lang} : {cmd} is not existing.") if '-help' in cmd and 'cmd-' in cmd: realcmd = cmd.replace('cmd-', '').replace('-help', '') texthelp = bot.get_command(realcmd).help.split("\n")[-1] text = texthelp or "This translation isn't working, please report this command and what you done to my dev with `=bug`." if weeb and can_owo: text = owo.text_to_owo(text) if 'help' in cmd or 'bot' in cmd or 'success' in cmd or 'failed' in cmd or 'dm' in cmd or 'warning' in cmd or '```' in text: # I've to admit that it's ugly but it's a lazy way to check if Watora sends a code block # basically if it's in a code block remove back slashes cus they are displayed text = text.replace('\\', '') return text
def owo_ise(text): groups = [] i = -1 def _inner(g): nonlocal i groups.append(g.group()) i += 1 return f"{{{i}}}" subbed = i18n.translator.TranslationFormatter.pattern.sub(_inner, text) owoed = text_to_owo(subbed) return sub_func.sub(lambda g: groups[int(g.group(1))], owoed)
async def owo(self, ctx): await ctx.send(text_to_owo(ctx.message.content))
# Why so sewiouws # ~/Library/Application Support/Steam/steamapps/common/Caves of Qud/CoQ.app/Contents/Resources/Data/StreamingAssets/Base/ # importing the module. import xml.etree.ElementTree as ET from lxml.etree import XMLParser from TextToOwO.owo import text_to_owo # parser = XMLParser(encoding='utf-8', recover=True) # parsing directly. convos = ET.parse('./Conversations_Base.xml') # UWUs all Text for text in convos.iter('text'): text.text = text_to_owo(text.text) # UWUS all choices for text in convos.iter('choice'): if (text.text != None): text.text = text_to_owo(text.text) convos.write('Conversations.xml') # QUESTS quests = ET.parse('./Quests_Base.xml') for text in quests.iter('text'): if (text.text != None): text.text = text_to_owo(text.text)
def echo(update, context): """Echo the user message.""" message = owo.text_to_owo(update.message.text) update.message.reply_text(message)
def help(update, context): """Send a message when the command /help is issued.""" update.message.reply_text(owo.text_to_owo("Help!"))
def start(update, context): """Send a message when the command /start is issued.""" update.message.reply_text(owo.text_to_owo("Hey!"))