Exemplo n.º 1
0
def get_api(bot):
    global API_CLIENT
    key = bot.parameters.get('wolfram key')
    if API_CLIENT is None and key:
        API_CLIENT = wolfapi.Client(key)
    return API_CLIENT
Exemplo n.º 2
0
No key was supplied for the Wolfram|Alpha API.

If you're trying to set the bot up for development, see README.md for information on how to do this.
'''

RERUN_EMOJI = '🔄'
EXPAND_EMOJI = '\U000025B6'  # ▶️
MAX_REACTIONS_IN_MESSAGE = 18

ASSUMPTIONS_MADE_MESSAGE = '**Assumptions were made**\nPress {} to show them.\n\n'.format(
    EXPAND_EMOJI)

api_key = core.parameters.get('wolfram key')
api = None
if api_key is not None:
    api = wolfapi.Client(api_key)

server_locks = set()
dm_locks = set()


def download_image(url):
    response = requests.get(url, stream=True)
    return PIL.Image.open(response.raw).convert('RGB')


MAX_GROUP_HEIGHT = 300
IMAGE_Y_PADDING = 10


def group_images(images):