Metadata-Version: 2.1
Name: lowerpines
Version: 0.5.0
Summary: Library wrapper for GroupMe API
Home-page: https://github.com/bigfootjon/lowerpines
Author: Jonathan Janzen
Author-email: jjjonjanzen@gmail.com
License: GNU Lesser General Public License v3 (LGPLv3)
Download-URL: https://github.com/bigfootjon/lowerpines/tarball/0.5.0
Keywords: api,GroupMe
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Topic :: Communications :: Chat
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Requires-Dist: requests

.. image:: https://circleci.com/gh/Bigfootjon/lowerpines.svg?style=svg
    :target: https://circleci.com/gh/Bigfootjon/lowerpines

==================
LowerPines Project
==================

This project provides a Python wrapper around the `GroupMe <http://groupme.com>`_ v3 API.

This is very much a work-in-progress and is **not** intended to be used in production environments.

===========
Basic Usage
===========

This requires a Access Token from the `GroupMe developers site <http://dev.groupme.com>`_

The first step to doing anything with this library is to create a ``GMI`` object::

    from lowerpines.gmi import get_gmi

    gmi = get_gmi(access_token='access token here')

A GMI object stores a copy of the Access Token and serves as a context for various functions.
The ``get_gmi(access_token)`` method will get a GMI from the cache or create one if necessary.
GMI objects also provide common functions::

    for group in gmi.groups:
        print(group, group.name)

    for bot in gmi.bots:
        print(bot, bot.group)

    for chat in gmi.chats:
        print(chat, chat.other_user)

    test_group = gmi.groups.get(name='Testing Group')
    test_bot = gmi.bots.filter(group_id=test_group.group_id)
    test_bot.post('Hello, world!')

GroupMe supports complex message structures, such as including GroupMe-specific emoji, pictures, etc. This information
can be utilized through ``ComplexMessage`` objects::

    from lowerpines.message import ImageAttach

    # This will dynamically create a ComplexMessage object:
    complex_message = ImageAttach('URL to GroupMe processed image here') + 'Look at my cool picture'
    test_bot.post(complex_message)

The various ``MessageAttach`` objects (such as ``ImageAttach``, ``EmojiAttach``, etc.) will automatically convert themselves into a ``ComplexMessage`` object when added to a ``str`` or to another ``MessageAttach`` object.
However, a ``MessageAttach`` object is **not** a ``ComplexMessage`` object, so the following is not allowed::

    test_bot.post(ImageAttach('URL here'))  # This will trigger an exception

The correct way to do this is to create a ``ComplexMessage`` object manually::

    from lowerpines.message import ComplexMessage

    complex_message = ComplexMessage(ImageAttach('URL here'))
    test_bot.post(complex_message)

Viewing messages for groups is also available::

    for message in test_group.messages.recent():
        print(message.text)

Each message's text is also available as a ``ComplexMessage`` object through ``message.complex_text``

Please see the ``doc/`` directory for more information.


