A Rust rewrite of Flameboi that will be more approachable for new developers to contribute to.

Overview

Devil Bot Rust

Overview

  • A Rust implementation of a Slack bot that will be used by the CodeDevils Slack workspace.
  • All resources are managed using AWS CDK.
  • The main driver is AWS API Gateway to provide static endpoints and AWS Lambda for serverless compute/request handling.

Prereqs

Getting Started with Git

  1. Create a new local directory for this project.
  2. Run git clone https://github.com/ASU-CodeDevils/devil_bot_rust.git in that new directory.

Set up AWS account

  1. Create a new AWS account for free: https://aws.amazon.com
  2. Go to the IAM console (type IAM in search bar on AWS website after logging in).
  3. Click on "Users" on the left-hand side bar under "Access Management".
  4. Click "Add Users" to the right.
  5. For username choose something like "devil-bot-test-user-${your_asu_alias}" (e.g. "devil-bot-test-user-jtmichel").
  6. Make sure "Access key - Programmatic access" check box is checked.
  7. Click "Next: Permissions".
  8. Click "Attach existing policies directly".
  9. Check "AdministratorAccess" (you can use less permissions if you know what you're doing, but this should work fine as long as you don't give away your credentials).
  10. Click "Next: Tags".
  11. Click "Next: Review".
  12. Click "Create user".
  13. Copy both your "Access key ID" and your "Secret access key" somewhere locally (only store this temporarily then delete).
  14. Continue to "Connecting to your AWS Account" steps below.

Connecting to your AWS Account

  1. aws configure
  2. For "access key" use your "Access key ID" from the "Set up AWS account" instructions above.
  3. For "secret access key" use your "Secret access key" from the "Set up AWS account" instructions above.
  4. For "default region name" use: us-east-1
  5. For "defaut output format" use: None (just leave blank and press enter)

Set up project for AL2 target Mac and Linux

  1. Ensure you've installed Rust, NPM, AWS-CDK Toolkit, and AWS-CLI.
  2. Confirm you've setup your AWS account and Connected it!
  3. chmod +x build-function.sh
  4. sh build-function.sh
  5. cdk bootstrap
  6. cdk deploy

After your project is set up use the following to build your code and deploy it to AWS test.

  1. sh build-function.sh
  2. cdk diff (optional, but useful command)
  3. cdk deploy

Useful CDK commands and their descriptions

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template
Comments
  • Rhett emoji and events

    Rhett emoji and events

    Referencing and #41 for emoji stuff.

    @jtmichelson Can I get a review?

    I'd like to refactor the ping command and get rid of the other Slack Crate we were initially using. That might go in this PR it's very smol and quick to do.

    enhancement 
    opened by reharri7 5
  • Message a user with when they have joined the workspace

    Message a user with when they have joined the workspace

    When a new member joins the workspace slack sends this event https://api.slack.com/events/team_join

    Using this documentation https://api.slack.com/messaging/sending message a user on behalf of my account with some basic info introducing myself and inviting them to introduce themselves in intros and come to hangout

    Others are welcome to work on this just run it passed Rhett so he knows what's getting sent on his behalf

    enhancement 
    opened by reharri7 3
  • Respond to Reaction Subscription

    Respond to Reaction Subscription

    SlackAPI can trigger a challenge to our AWS API when a reaction is left on a user's message. See here for Reaction Added documentation

    I have added the subscription and slack will trigger this every time that a reaction has added.

    1. Implement a way to respond to the reaction
    2. Start with the :buns: reaction
    3. If a message contains "buns" or the buns emoji, add the :buns: reaction.
    4. Remove the message reply inbuns.rs after adding this logic.
    enhancement good first issue 
    opened by reharri7 3
  • Adding develpment var flag

    Adding develpment var flag

    When devilbot is handling an event, it checks accordingly to the event to see if it should respond. If it is a development stage and the event came from outside the test channel then the function returns. Resolves #54

    opened by reharri7 2
  • Onboarding a new member

    Onboarding a new member

    @jtmichelson I would like a review on this. Upon review this should enter an acceptance testing phase where when this event fires the message will just be sent to my account rather than the user that fired the event. After I can confirm that is working then I can change it over to the username that is coming from the body and this can be merged

    enhancement 
    opened by reharri7 2
  • Create Unified POSIX setup (Mac and Linux)

    Create Unified POSIX setup (Mac and Linux)

    • [x] Amend README.md to reflect creation of a unified POSIX (Mac and LInux) setup instruction
    • [x] Amend build-function.sh to automatically configure, build, and install requisite packages for rust and npm based on kernel/architecture.
    documentation enhancement 
    opened by stucamp 2
  • Create a DevilBot

    Create a DevilBot "Slack App" to Set-up OAuth

    In our Slack workspace, we should make a new Slack App similar to "Flameboi", maybe just copy the permissions over from that previous app. Then communicate in the #devilbot-dev Slack channel the new OAuth creds so we can configure API Gateway accordingly.

    opened by jtmichelson 2
  • Make a post ephemeral message

    Make a post ephemeral message

    Use this documentation to make a method for ephemeral messages. This will be a reusable feature to post messages in channels that are only visible to the user that is passed in.

    enhancement 
    opened by reharri7 1
  • Request to Slack for a Dynamic Web hook URL

    Request to Slack for a Dynamic Web hook URL

    Link to Slack Documentation

    Currently the only way we can generate an incoming webhook is through the SlackAPI website. This is not ideal because it limits the amount of channels and users we can interact with. We need to generate a webhook programmatically.

    Example: Brandon wants to implement a safety feature in the workplace that detects profanity in the hangout channel. It would be a simple matter to let the bot post a message to the hangout channel when profanity is detected. However, Brandon is not a simple developer who settles for static messages. He is an Alpha Giga Chad who would like to implement a feature that DMs the user who posted profanity (now a dynamic situation) and insults them in private.

    Implementing this feature would open DevilBot to many different channels that it listens to, and can react in those situations.

    enhancement help wanted 
    opened by reharri7 1
  • Resolves #3

    Resolves #3

    Resolves #3 #1 Confirmed the build-function.sh works on Windows in WSL2 Ubuntu 20.04 LTS. Amended the README.md to reflect the setup for Windows machines.

    documentation enhancement 
    opened by stucamp 1
  • Add Contribution / Git Workflow Section to README.md

    Add Contribution / Git Workflow Section to README.md

    Standardize the contribution process for this project.

    1. All PRs related to issues should have the first line of their body/description include the resolves keyword and what issue it is meant to resolve (e.g. Resolves #2 to resolve issue #2). This auto-links the PR to the issue.
    2. Assign at least 1 other reviewer to your PR and get explicit approval before merging (See issue #7).
    3. Put clear descriptions in PR bodies to help the reviewer understand all context of your changes. Adding testing details if required.
    4. Add an overview of how to do a simple Git workflow for creating a pull request with a new branch for new contributors that may not have used Git before.
    5. Brainstorm any other standards.
    opened by jtmichelson 1
  • Reply to introduction in intros channel

    Reply to introduction in intros channel

    Main feature contribution: DevilBot will now watch the intros channel and reply to user's introductions

    Supporting contributions: Chat Post Message now receives the tread timestamp as an Option param. Now able to receive all the replies from a message

    So this is working but there are some things that I know there is probably a better way to do in rust. Specifically, I am not sure if the way I added an optional parameter to the request in chat_post_message.rs was the best way. I also think that message_event_handler.rs is getting cluttered with logic. I was thinking I should create a handler for messages in specific channels where it is necessary

    @jtmichelson closes #51

    enhancement 
    opened by reharri7 1
  • Periodic emoji definitions

    Periodic emoji definitions

    DevilBot will keep track of every time an emoji is used in a message. When that emoji has been used (example) 100 times, it will send a message to the channel it was last sent in with the Emoji, its definition, and an example sentence.

    Be sure to only count the message once if the emoji is used more than once in the message. Account for multiple different emojis in the same message.

    Example: Croatia played like :buns: in the world :cup: today. I hope they take their :buns: back to Europe Should count buns and cup each once

    enhancement good first issue 
    opened by reharri7 0
  • Reply to an introduction in intros channel

    Reply to an introduction in intros channel

    DevilBot will reply to a thread if there is a reply to a message that contains Welcome to CodeDevils, AND the reply is in intros, AND DevilBot has not already responded to the thread. We only want devilbot responding to things that are actually intros and not responding more than once.

    DevilBot should respond with some introductory information about itself

    enhancement good first issue 
    opened by reharri7 4
  • Add a /help command

    Add a /help command

    Placeholder ticket. This was requested by a new member as of this year who is now an officer. Probably just message the user a list of info about the workspace, or use postEphemeral to give the info they need

    enhancement 
    opened by reharri7 0
  • Add a deployment pipeline

    Add a deployment pipeline

    • Make DevilBot partially CD.
    • Use AWS Code Deploy to deploy code via merged commits to the main branch of our remote repo.
    • Remove perms for devs to deploy directly to the prod CDK stack.
    enhancement 
    opened by jtmichelson 1
Owner
CodeDevils
An ASU student organization
CodeDevils
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A Nest rewrite of crystal, the SOS Discord bot

crystal-nest A Nest rewrite of crystal, the SOS Discord bot Explore the docs » Report Bug · Request Feature Table of Contents About The Project Built

PR1SM 5 Dec 22, 2022
Detect F12 open console, protect web static resources, support redirect, rewrite, callback strategies.

console-ban Detect F12 open browser console. protect web site static resources, support redirect, rewrite, custom callback strategies. Language: Engli

Yingci 623 Dec 26, 2022
Rewrite of revoltchat/revite.

Solid App (name TBD) This is still a work in progress, please do not create any issues and clear any PRs with me ahead of time. See code style guideli

Revolt 17 Jan 7, 2023
A great result management solution for schools, hospital, academy and other. If you are a php developer, contribute to this respository for more advancement of the project.

result-management-pro A great result management system for schools, hospital, academy and more. Contributions Willing to add more features to this gre

Adeleye Ayodeji 8 Jun 17, 2022
Contribute code, meet community members, participate in workshops, and win more SWAG 🚀

Welcome to Hacksquad 2022! Contribute code as a team, meet community members, participate in workshops, and win SWAG With the fantastic atmosphere of

Novu 57 Dec 21, 2022
We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

#AuthWiki Resource Product Documentation Figma Database Schema First Presentation Live Link API Documentation Individual Contributions User Activity U

Zuri Training 17 Dec 2, 2022
This terminal application aims to help new developers to quickly create ready to play applications, powered by Supabase.

Welcome to Create Supabase App ?? ⚡️ ?? Supabase is an open-source Firebase alternative. This terminal application aims to help new developers quickly

Raphaël Moreau 17 Nov 8, 2022
A Mindustry mod that is public for anyone to contribute. Star the mod for access.

Star the mod and I will add you as a contributor. Rules for contributors Only delete or edit content if you have permission, or if you made the conten

null 6 Jul 25, 2022
CONTEST 11: 🥳 #profileathon-22🥳contribute to this repo by adding your participation profile to the hacktoberfest2022

Profileathon Happy Hacktoberfest! Hacktoberfest is back ?? Profileathon is a list of profiles of Hacktoberfest 2022 participants. Link to webpage: htt

CodeMacrocosm 34 Oct 29, 2022
All terminal commands in one place (you can Contribute to it by putting latest commands and adding Readme)

Terminal-Commands All basic terminal commands in one place Show some ❤ by some repositories You can contribute to this readme If you to contribute wit

Shehzad Iqbal 7 Dec 15, 2022
Want to *contribute* to *open source*? Participate in **HacktoberFest 2022** *Beginner friendly* *First Timer*

# HacktoberFest 2022 (No Longer Participating in hacktoberfest) THIS REPO IS NO LONGER CONSIDERED IN HACKTOBERFEST. YOU CAN STILL USE THIS REPOSITORY

Jitender Singh Chhapola 5 Nov 12, 2022
Hacktoberfest is Digital ocean's annual event that encourages people to contribute to open source throughout October.

Hactoberfest 2022 For contributions to web-based projects for Hacktoberfest 2022, please use this public repository. This is React application make su

GDSC AIT Pune 5 Oct 10, 2022
Contribute some nodejs programs here ;)

Nodejs Programs Showcase Table Of Contents Prerequisites Contributing Prerequisites In God we trust. All others must bring data. Need to be courageous

koderDev 3 Oct 9, 2022
Reddit Page CLONE using Angular! A repository to contribute at hacktoberfest 2022. Make sure to share love by giving it a star.🌟 Have a great day!

Reddit_tool Reddit Site CLONE using Angular, Springboot and Swagger OpenAI ! Introduction This project was developed with the following technologies:

Momo-Solaris8 4 Oct 20, 2022