Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def univsaye(cowmsg):
""" For .cowsay module, userbot wrapper for cow which says things. """
if not cowmsg.text[0].isalpha() and cowmsg.text[0] not in ("/", "#", "@", "!"):
arg = cowmsg.pattern_match.group(1).lower()
text = cowmsg.pattern_match.group(2)
if arg == "cow":
arg = "default"
if arg not in cow.COWACTERS:
return
cheese = cow.get_cow(arg)
cheese = cheese()
await cowmsg.edit(f"`{cheese.milk(text).replace('`', '´')}`")
"""Utility functions for cowsay/slack integration.
"""
import json
import random
from cowpy import cow
import requests
import settings
COW_OPTIONS = set(cow.cow_options())
def say(text, name='default'):
"""Return some cowsayed text."""
cowacter = cow.get_cow(name)()
return cowacter.milk(text)
def parse_cowacter(text):
"""Parse out the name from the start only if it's a valid cow name at
the start of the string with double dashes. Returns (name, text).
"""
name = 'default'
text = text.strip()
".":".-.-.-",
",":"--..--",
":":"---...",
"?":"..--..",
"'":".----.",
"-":"-....-",
"/":"-..-.",
"@":".--.-.",
"=":"-...-",
" ":"/"
}
decode_morse = dict((morse_char, char) for (char, morse_char) in encode_morse.items())
cowList = {
"cow":cow.Cowacter(),
"hellokitty":cow.HelloKitty(),
"bunny":cow.Bunny(),
"cheese":cow.Cheese(),
"milk":cow.Milk(),
"bong":cow.BongCow(),
"eyes":cow.Eyes(),
"legitvore":cow.HeadInCow(),
"666":cow.Satanic(),
"frogs":cow.BudFrogs(),
"daemon":cow.Daemon(),
"moofasa":cow.Moofasa(),
"mutilated":cow.Mutilated(),
"skeleton":cow.Skeleton(),
"small":cow.Small(),
"excusemewhatthefuck":cow.Sodomized(),
"garfield":cow.Stimpy(),