Toriel is currently undergoing a new revamp! You can view the stuff being worked on here, and take part in #toriel-dev, if you're on the slack
Just a lil' ol greeter bot to direct new members joining the Hack Club Slack. You wonder what she might say...
Toriel is a fork of Clippy.
Contributions are encouraged and welcome!
In order to run Toriel locally, you'll need to join the Hack Club Slack. From there, ask @creds to be added to the Toriel app on Slack.
-
Clone this repository
git clone https://github.com/hackclub/toriel && cd toriel
-
Install ngrok (if you haven't already)
-
Install dependencies
npm install
-
Create
.env
filetouch .env
- Send a message mentioning
@creds
in Hack Club's Slack asking for the.env
file
-
Start server
npm run dev
-
Forward your local server to underpass, an open source alternative made by a Hack Club team member.
-
Update the settings in the manifest.yml
- Change the slash command and event endpoints by replacing
https://toriel.hackclub.com
with your ngrok URL- You can find your ngrok URL in the terminal where you ran
ngrok http 3000
. It would look similar to this (your ngrok URL will be different): - Take this URL and replace it with all
https://toriel.hackclub.com/slack/events
URLs (the first slash command url, second slash command url, event url, and interactivity url. Include/slack/events
so your new URLs would beyour-ngrok-URL/slack/events
.
- You can find your ngrok URL in the terminal where you ran
- Change the app and bot name from
TORIEL
to something that doesn't start withT
(ex.msw-dev-toriel
). This prevents Slack's auto-suggestions from confusing new users. - Change the slash commands from
/toriel-COMMAND
to something that doesn't start witht
(ex./toriel-restart
->/msw-dev-restart
).
- Change the slash command and event endpoints by replacing
-
Update slash commands
- Go to index.js and find the following line
- Change
/toriel-restart
and/toriel-call
to your own slash commands likemsw-dev-restart
-
Go to api.slack.com to create a new slack app
- Select "from an app manifest" When prompted, make sure you select the Hack Club Workspace (you might need to sign in).
- On the next modal, replace the demo manifest with your edited manifest.yml
-
Click "Install to Workspace" under the "Basic Information" tab in the settings bar
-
Edit the env variables in .env file.
SLACK_SIGNING_SECRET=SIGNING_SECRET SLACK_BOT_TOKEN=Bot_User_OAuth_Token
where
SIGNING_SECRET
is your app's Signing Secret, which you can find by clicking on "Basic Information" in the settings bar and scrolling down (click show to and copy it) andBot_User_OAuth_Token
is found under "OAuth & Permissions" (You will need click "Install to Workspace" before you can view the token) -
Create a private channel where your app can run the welcome flow. Similar to the role that #in-the-cave plays for Toriel (run
toriel-restart
in slack to see what this means).- Invite your bot to that channel (you can @mention it to add)
-
Edit transcript.yml. If you want to make your own local transcript.yml with your own channels for testing, call it
transcript.dev.yaml
, and it will load from that instead, however, it won't be synced to production.- The key:value pairs under
channels:
representchannel-name:channel-id
and these are referred to elsewhere in the codebase with{channels.channel-name}
-
You can add your own bot to these channels for testing or you can delete or comment out channels you don't need for testing
IMPORTANT: you might need access to these channels later on, like to add a new user to channels, which means not giving your bot access now could break the app.
-
Add your own private channel to the channel list. For example, if your channel is
msw-test-cave
with the channel idCDF1A5EG865
, you would add:msw-test-cave: CDF1A5EG865
-
You can find the channel ID by opening the channel and clicking on the channel name in the top left. Scroll down the modal and you should see it in the bottom left corner
- The key:value pairs under
-
Do a global find and replace in the codebase to update
channels.cave
tochannels.name-of-your-private-channel
- As
{channels.cave}
refers to#in-the-cave
, we need to replace it with the private channel (ex.{channels.msw-test-cave}
) that you created for your bot
- As
-
Run
npm run dev
again and also reinstall your app to the workspace (under Basic Information)
If you run into an error where the message reads Toriel is not invited to these channels
or channel_not_found
, just invite your bot to that channel (you can check the channel with its ID by referring back to transcript.yml. If the channel is private, you can create a new private channel as its substitute, but remember to update the references in the code. Ex. #toriels-diary
is a private channel, so you can create #msw-toriels-diary
, add it to transcript.yml, and change all {channels.toriels-diary}
to {channels.msw-toriels-diary}
.
Note: you have to re-update the Underpass tunnel URL on the Slack app manifest and verify the URL each time to restart the server, since the tunnel URL changes
Formatting is important, please run npm run fmt
on contribution.