File: status.py

package info (click to toggle)
poezio 0.15.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,108 kB
  • sloc: python: 24,816; xml: 987; ansic: 329; makefile: 200; sh: 20; javascript: 2
file content (43 lines) | stat: -rw-r--r-- 901 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
This plugin adds several aliases, to shorten status changes.

Aliases
-------

.. glossary::
    :sorted:

    /afk
    /away
        Set your status to ``away``

    /dnd
    /busy
        Set your status to ``dnd``

    /available
        Set your status to ``available``

    /chat
        Set your status to ``chat``

    /xa
        Set your status to ``xa``

"""
from poezio.plugin import BasePlugin


class Plugin(BasePlugin):
    """
    Adds several convenient aliases to /status command
    """

    def init(self):
        for st in ('dnd', 'busy', 'afk', 'chat', 'xa', 'away', 'available'):
            self.api.add_command(
                st,
                lambda line, st=st: self.api.run_command('/status ' + st + ' "' + line + '"'),
                usage='[status message]',
                short='Set your status as %s' % st,
                help='Set your status as %s' % st)