GithubHelp home page GithubHelp logo

rafasaur / sharkbot2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peterthehan/create-discord-bot

1.0 1.0 0.0 30.51 MB

a simp discord bot with a simple widget-based framework for friends :)

JavaScript 100.00%

sharkbot2's Introduction

sharkbot (v2.14)

Sharkbot is my attempt at a modular Discord bot, with a fair amount of functionality out of the box, and the ability to quickly and easily add/remove pieces as needed. In theory, one bot could be used across multiple Discord servers, but it is not currently written to do so effectively and it is very likely at least one thing will break.

Overview

The most recent updates for Sharkbot finally use Discord.js v13, which required some minor code updates to align with the new API. The file structure received a much more substantial reworking, to improve accessibility for commonly edited files, and readability overall.

Some commands are now available as slash commands! The main reason for some, not all, is that interactions are handled differently than messages, which breaks some finer functionality of commands I've currently implemented. Certain commands will be converted into slash commands, but others (namely affirm) will remain "old school" by necessity.

Getting him up and running

Just check out a copy, go through each .config/<widget>.EXAMPLE.js filling in blanks, and deleting the .EXAMPLE from the filename. Peruse to find other EXAMPLE files and make your own, or just delete them. Finally, replace <your token here> with your bot's token in .env. It should work immediately!

Features & Commands

Fine-grained documentation of Sharkbot's features (or "widgets") can be found in that readme, and likewise for the default commands.

All features are loaded via their folder in /src/widgets. All features require, at minimum, a <feature>.js file with active: true in the /.config folder. Any features with "rules" are loaded from their respective folder/files in /.rules. Any features beginning with ~ in their name will not be loaded (by default, ~template is the only one).

alarms

Send messages at specific times, according to cron rules. A certain amount of randomization is allowed.

askbox

Designates a channel in the server to be an suggestion box. Messages sent there can be sent to a mod-only channel for private discussion, as well as deleting the original message for anonymity.

command

Allows for command usage (both old-school "text" commands as well as slash commands) and loaded by default, so each widget can have its own commands to increase readability. It may be worth mentioning in cases where a text command and a slash command have an identical function, the bulk of that code is pushed into a "shared" file.

haiku

Reformat and post messages that are haiku. Frequency & allowed channels can be adjusted.

levels

A mild moderation assistant. Assign roles based on how long people have been in the server, how much and widely they post, etc.

log

Allows for printing of all observed messages, and the CC-ing of DMs sent to the bot to the owner.

member-db

Persistent member data through restarts.

message-reacts

Perform certain actions based on contents of sent messages.

poll

Members can create polls, and Sharkbot will automatically react with relevant emoji to assist in "voting." Members can be notified of the results after a certain amount of time has passed.

reaction-roles

Assign roles based on members reacting to specified messages.

scrycall

A magical card info gatherer.

shoutbox

Designate a channel to allow members to ask/shout things at the server anonymously.

smooth

Kick and re-invite members in one breath.

welcome

Send a welcome DM to new members.

Resources and references

I call Sharkbot my son, but it would not have been possible without drawing on numerous examples and documentation from other discord bots, especially now that he is officially a fork of peterthehan's create-discord-bot, and both alarms and reaction-roles come from their implementation as well (but have been updated slightly to ensure functionality and compatibility).

Sharkbot originally grew from the Discord.JS guide, but I wanted a cleaner method of loading its various features, and calling functions from different events. My original thought was to have individual handlers for each event, but that quickly grew unwieldy as well, and needed more manual overhead than I wanted, and I still ended up with clunky and bloated looking files. Finding peterthehan's work was a godssend, especially after the 100th time I broke my event handlers. Everything is modular, which is exactly what I was aiming to do, and was the next step I was trying to wrestle with. I was worried at one point I was removing some modularity, but I think I have instead improved upon it.

And of course the biggest thank you to everyone who's helped raise/test my son (Thad in particular) and answered my questions in the Discord.js discord.

In progress/to be implemented

  • the ability to add alarms...?
  • birthdays!
  • twitch alerts
  • music streaming

sharkbot2's People

Contributors

dependabot[bot] avatar peterthehan avatar rafasaur avatar shadowtime2000 avatar

Stargazers

 avatar

Watchers

 avatar

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.