Cover image for Making Slack More Fun with Slacky

Making Slack More Fun with Slacky

m4cs profile image Max Bridgland ・2 min read

Imagine being able to automate tasks, add custom notifications, custom commands, and add more fun things to do in Slack with your coworkers. Well I made it possible since there were no other Python selfbots Open Sourced on GitHub for Slack. I had always enjoyed using selfbots on Discord but since they were against ToS I had stopped. Slack on the other hand has no issues with these "custom integrations" and if anything, enable it. So today I present to you, Slacky.

Alt Text

Slacky is a personal token based approach to the common Slack bot. It allows for all RTM functionality a normal Slack bot would, but it uses your account to do it. It reads messages from your user in order to automate and make your messages more fun. It comes with a load of commands off the bat but also allows for easily adding plugin packs or your own custom Python commands.

Below you can see a preview of the tool:


It's also really easy to add your own plugins. A simple example plugin takes less than 30 lines! Here is an example:

from slacky import client, config, Prefixes, check_user
from slack.errors import SlackApiError

def custom_example(**payload):
    # Get Data from Payload
    data = payload['data']
    channel_id = data['channel'] # Get Channel ID
    user = data.get('user') # Get User
    timestamp = data['ts'] # Get msg Timestamp
    if check_user(user): # Check if User == You
        web_client = client # Init Client
        text = data.get('text') # Get Text
        # Check for Command Here
        if text:
            text_split = text.split(' ')
            cmd = text_split[0]
            if cmd == config['prefix'] + 'example':
                # Command has been triggered
                print(Prefixes.event + 'Ran Command: example')
                # Do your logic here and then update the message at the end below.
                        text="This command is an example custom command."
                except SlackApiError as e:
                    print(Prefixes.error + str(e))
Enter fullscreen mode Exit fullscreen mode

There are a bunch of default commands as of the first release already. Below is a table of said commands:

Command Description Usage
heartbeat Check if bot is up or not ~heartbeat
info Get info about the bot ~info
ascii Generate ASCII art from a phrase ~ascii msg
shift CrEaTe ShIfT tExT lIkE tHiS ~shift phrase
subspace Replace spaces with emojis ~subspace :emoji: msg
setprefix Sets bot command prefix ~setprefix prefix
xkcd Get Daily xkcd comic ~xkcd
delete Delete X num of your msgs ~delete num_of_msgs
react React to last sent message ~react :emoji:
reactrand React to with random emoji ~reactrand
reactspam Spam 23 Reactions (Notification Spam) ~randspam
howdoi Find code snippets from stack overflow ~howdoi loop over list python
listener Add or remove listeners ~listener add/delete phrase
listener list List all listener words ~listener list
help Display this message ~help

You can run this locally or with Docker to have it run in the background! The source code is available here and any plugin packs would be greatly appreciated! You will be featured in the README just make a Pull Request with any plugin packs you make.


Editor guide