Signal your A.F.K. status on Slack automatically
Project description
Signal you A.F.K. (Away From Keyboard) status on Slack, automatically.
Installation
pip install afk_slack_agent
What it does?
This software is distributed with an agent (afk_agent) and a client (afk, optional).
The agent is designed to be run in the background and stay active until you terminate it.
Features implemented by the agent
waits for lock screen and unlock screen events
connects to a Slack workspace, and change user status on lock (clean it on unlock)
optionally: write a message on a channel on lock/unlock
Prerequisites
you have to create a Slack application, and install it into your workspace - the application should have at least the following scope: users.profile:write.
optionally, you could also enable chat:write and reactions:write
to run custom AFK commands from the client, you’ll need to enable the agent to control your Mac (from “Privacy and Security” system settings)
Configuration
The first time the agent is run, a ~/.afk.json file is created.
This is the default file created:
{
"version": 1,
"token": "",
"status_text": "I need a break",
"status_emoji": ":coffee:",
"channel": null,
"away_message": "I'm going to take a coffee break",
"back_message": "I'm back",
"delay_for_reaction_emoji": 60,
"back_emoji": "back",
"agent_emoji": "robot_face",
"agent_active_start_time": null,
"agent_active_end_time": null,
"actions": [
{
"action": "lunch",
"status_text": "Lunch break",
"status_emoji": ":spaghetti:",
"away_message": "I'm going to take the lunch break",
"back_message": "I'm back and stuffed!",
"command": "lock"
}
]
}
The most important key is token, which must contain the Slack User OAuth Token.
Other settings
- status_text
Status to be set when locking the screen
- status_emoji
emoji to be set when locking the screen
- channel
use this only if you want to write messages on a channel when going AFK and be back.
Put the channel id there. You can find it by right-clicking on the channel and clicking “View channel details”. It will be at the very bottom of the popup.
- away_message
message to send when going AFK
- back_message
message to send when back to keyboard
- delay_for_reaction_emoji
in case you will be back before this amount of seconds, do not send a back message, but just react to your away message using a reaction emoji. This will reduce noise in case of quick lock/unlock screen
- back_emoji
emoji to be used for quick back reaction
- agent_emoji
automatically adds this emoji at the end of every message sent or slack status set. This helps others to know there’s a bot that is acting for you.
- delay_after_screen_lock
before starting interacting with Slack, wait this amount of seconds.
This will delay reactions to your lock screen status a while, so no Slack commands will be run if you unlock the screen before this time. As example: you are reading a document and the screen locks for inactivity, but you are not AFK.
- agent_active_start_time and agent_active_end_time
time range inside which agent is effectively working.
When provided (in the format as HH:MM), the agent will only effectively works when current time is inside this (potentially open) time range. This can be used to disable the agent when using your computer outside working hours.
This is not applied to explicit actions (afk <command>).
Custom actions
The JSON configuration can contain an actions key, with an array of custom actions.
Custom actions can be sent to the agent using the client component:
afk lunch
A custom action is a way to perform something more than the standard lock/unlock monitor.
See the afk command line help for more.
An action interact with Slack in the same way the agent does, and inherit the same configuration, but it can override some of them like: status_text, status_emoji, away_message and back_message. Every of these settings can be null to explicitly inherit from the global settings. back_message can also be false: this disables the back message for the action even if the global setting has a value.
Finally, a custom action can perform one of the following commands:
- lock
Lock the screen manually
- sleep
Put you computer to sleep
Why?
To understand motivation about this tool, read why I needed to join my lock screen activities with Slack.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file afk_slack_agent-0.2.0.tar.gz
.
File metadata
- Download URL: afk_slack_agent-0.2.0.tar.gz
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf9be7d604184d615da971a6d598630ec6db52716d74ac39be32de6cae83e81 |
|
MD5 | 46b6a195846f003aff57bc6cbf3a13b5 |
|
BLAKE2b-256 | 7be23080e1562132bdc28b780da25cabde8c0e0fc8637b96cd5226ea824f896c |
File details
Details for the file afk_slack_agent-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: afk_slack_agent-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f33d891b35fbdc5a4082e0e61c2395877c7ee84f1bc8b9162bfc2e1d229668 |
|
MD5 | e55ce563feb6748cfb7e2ab4b36bb46a |
|
BLAKE2b-256 | 28cd9301eaee646a9738f5e1cc6a97cad49d113b05b2cd0b75193aa09ef0d211 |