Ejemplo n.º 1
0
from setuptools import setup, find_packages
from libslack.version import VERSION_TEMPLATE, MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION

setup(
    name='libslack',
    version=VERSION_TEMPLATE.format(major=MAJOR_VERSION, minor=MINOR_VERSION, patch=PATCH_VERSION),
    packages=find_packages(),
    install_requires=['docopt'],
    url='https://github.com/Nicoretti/libslack',
    license='BSD',
    author='Nicola Coretti',
    author_email='*****@*****.**',
    description='A lightweight wrapper around the slack web API.',
    entry_points={
        'console_scripts': [
            'scmd=libslack.scmd:main',
            'sls=libslack.sls:main',
        ],
    },
    keywords=['slack', 'cmd', 'api', 'shell'],
)
Ejemplo n.º 2
0
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import cmd
import sys

import docopt

from libslack import slackapi
from libslack.utils import try_to_get_auth_token
from libslack.version import VERSION_TEMPLATE

__author__ = 'Nicola Coretti'
__email__ = '*****@*****.**'
__version__ = VERSION_TEMPLATE.format(major=0, minor=1, patch=0)


class SlackShell(cmd.Cmd):

    def __init__(self, auth_token):
        """
        Creates a new SlackShell which can be used to query various data from the slack server.

        :param string auth_token: which will be used authenticate against the slack server.
        """
        self.intro = "Slack Shell (SLS)\nTo get help type help\n"
        self.prompt = "((SLS)) >>> "
        super().__init__()
        self.slack_api = slackapi.SlackApi(auth_token)
        self._quit = False