Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import asyncio
from functools import partial
from slacker import Slacker
__alias__ = 'Slack 状态同步'
__version__ = '0.1'
__desc__ = 'Slack 状态同步'
slack = Slacker('xx')
def sync_status(song):
if song is None:
status_text = (song.title_display or 'unknown') + \
' - ' + \
(song.artists_name_display or 'unknown')
profile = u'{"status_text": "正在听:%s", "status_emoji": ":headphones:"}' % \
loop = asyncio.get_event_loop()
loop.run_in_executor(None, partial(slack.users.profile.set, profile=profile))
def enable(app):
app.player.playlist.song_changed.connect(sync_status, aioqueue=True)
def disable(app):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.