Git Product home page Git Product logo

fcc-bot-go's Introduction

FCC-Bot

ver. 3.0.0

Description

FCC-Bot is a discord bot used on the FCC Seoul Discord server. It is written in Go.

Its primary library is discordgo.


The instructions for this bot assume you already have a bot set up in the discord developer portal, and it is already invited to a server.

For development purposes, it is recommended to set up a new, private server that mirrors the structure of your production server.

If you are intending to fork FCCBot to use in your own server, understand that whilst FCCBot is built with some level of modularity in mind, it will require work to reshape it to fit your own needs.


Getting Started

Installation

  1. Clone the repository.
  2. Run go get to install the packages needed.

Running

Environment Variables

You will need to create .env files before running the bot: dev.env and prod.env.

NOTE: Running the bot in dev or prod mode does not require the other .env file.

env variable how to obtain
BOT_TOKEN The private key Discord gives you for a bot
BOT_ID The bot's user id: right click the bot in the server
GUILD_ID The guild's id: right click the server's name in discord
LOG_CHANNEL The log channel's id: create a channel, and right click it
INTRO_CHANNEL The introduction channel's id: create a channel, and right click it
LEARNING_RESOURCE_CHANNEL The learning resource channel's id: create a channel, and right click it
RFR_POST The post to listen for react-for-role reactions: create a post, and right click it
ROLE_VERIFIED The role users receive when validated: create a role, and right click it
DB_PATH The path of the database file: specify where to save the database file

NOTE: We recommend the DB_PATH point to ./app/db/_store/{db_name}.sqlite. This path is already added to the .gitignore file.

Commands

Command use
go run ./app/*.go Run the app using dev envs
go run ./app/*.go -p Run the app using production envs
go build -o fccbot ./app/*.go Build the app to a file named 'fccbot'
make run Makefile command for running the app in dev mode
make build Makefile command for building the app
make deploy Makefile command to run the app as a process in PM2
make stop Makefile command to stop the app with PM2

NOTE: The above commands assume you are running the bot on Mac or Linux, and have PM2 installed globally. NOTE: go-sqlite3 package requires the environment variable CGO_ENABLED=1 and a gcc compiler present within your path.

fcc-bot-go's People

Contributors

devldm avatar tobio89 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

devldm

fcc-bot-go's Issues

Add tests for basic DB operations

Tests for creating a new DB and connecting to it.

The test should make a new DB file, connect, disconnect, and then delete the file.

Improve command interaction response

I want to make a function to wrap the interaction response so that it takes up less space.
It can also wrap interaction response with the error log for if it didn't work.

Add RFR roles for languages and learning status

  • Using our server's custom emojis for programming languages, add this to RFR so people can specify what they know or what they are learning

  • Add roles for 'end': FE, BE

  • Add roles for learning status: 'Learning', 'Professional'

Fix the Delete command

The delete command doesn't work properly.

The intended usage is:

  • Single delete: select one post ID to delete
  • Delete from: select one post ID and delete all posts from that post to current
  • Delete to: not used
  • Delete from - to: select a from post ID and a to post ID, and delete all messages in between.

The complication lies in Discord not allowing you to combine from and to selection in their get messages feature

Add a ThankCommand or way to track thanks within the server

The issue

Currently there is no way to thank other users in the server outside of a basic message or emoji. We also currently don't keep track of thanks so it's hard to see who contributes most to users in need.

The suggested solutions (1 code complete, 1 WIP)

Thanks Command - Code complete

I believe one solution to this could be the addition of a ThankCommand. This would allow others to call out users and share the appreciation as a new thanks message is created by the bot which could be sent to any channel. (a specific thanks channel in my changes) .

The changes to add this command can be seen here. If the changes seem like a good suggestion i can re-create the PR merging into this repository where we can discuss changes etc so we don't lose git history / context.

Emoji tracking - WIP

This would need further work but the initial changes can be seen in a WIP pr here. We add a check for a newly added thanks emoji where we could trigger methods to track or handle the data.

I think the addition of a thank specific emoji as seen here could be a good move regardless of the above changes progress.

Next steps

I am happy to do some further work on Emoji Tracking or raise a new PR for a thanks command as a follow up to your thoughts but i wanted to raise my suggestions here as a issue first.

If neither of these seem like a good move for the bot feel free to close the issue or offer alternative paths if you have something in mind but don't quite have the time to implement! Thanks.

Admin-updatable Welcome Message

I want to add a feature where admin can edit the welcome message for the bot.
The bot should read the welcome message from the DB before posting it.

The admin will post the welcome message as a regular message, and copy that message's ID.
The command takes the message's ID and the bot will find the message, copy the content, and save it to the DB.
It needs to maintain the markdown structure.

The bot should store the time the welcome message was updated.
Rather than loading the message from DB each time, it can check the updated time, and then reload the message only if it's been changed.

We will probably need a command to test the welcome message, so that we can make sure it's correct.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.