Coder Social home page Coder Social logo

spookybot's Introduction

SpookyBot

๐ŸŽƒ A spooky Discord bot

release issues stars forks

This project is convenient for people who want to get into open source and contribute to different projects especially during the Hacktoberfest.

Don't hesitate to ask me for help on my Discord server, I would help you with great pleasure!

๐Ÿค– Add the bot on your server

You just need to click on this link and validate the form without changing any permission.

๐ŸŒ Adding a language

You can add languages to the robot so that it is translated and accessible to everyone!

To do this, nothing could be simpler, just copy the file ./app/lang/en.js then rename it following the ISO 639-1 nomenclature. Then you just need to modify the file as you wish. For the translation to be set up on the robot, do not hesitate to open a pull request by following this guide.

To react to a word, you need two elements in the translation file: the word and the emoji with which it will react.

{
  "name": "halloween",
  "emoji": "๐ŸŽƒ"
}

You can see that the emoji element is an emoji, but you can also use a custom emoji. For that, I strongly advise you to read this guide.

๐Ÿ’ป Testing locally

  1. Create a bot on the Discord developer portal,
  2. Create a webhook on your own discord server by following this tutorial,
  3. Copy the ./app/config/config.example.json from the project to ./app/config/config.json and fill in the gaps with the information from the bot and the webhook. The first token is on the bot page accessed from the side of the Discord Developer Portal, and the webook information is found on the page when you navigate to the webhook url,
  4. Invite your dev bot to your server by following this url, replacing the client id with your bot's client id (found on it's general information page), and the permissions with the Permission Integer created in the Developer Portal as you select permissions for your bot,
  5. Once these steps are setup, simply run make startup_dev from the terminal in the root directory of the repo, 5.1 If you want to install node modules you could just add it into your local package.json and run the make build_dev_image after that you need to recreate the container.
  6. Test the bot is connected by running <your-prefix>help to get a list of commands, and then initialize the DB by running <your-prefix>emitgc. It should then respond with "Join with <#> users,
  7. Test that the bot reacts to comments by typing one of the words in lang/<your-lang>.js. The bot should respond with an emoji!

๐Ÿ‘ค Author

LucasAlt

๐Ÿ™ Thanks

๐Ÿค Contributing

Before contributing to this project, make sure you have read the contribution guidelines!

  1. Fork it (https://github.com/LucasCtrl/spookyBot/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Show your support

Give a โญ๏ธ if you like this project!

Buy Me a Coffee at ko-fi.com

๐Ÿ“ License

This project is open source and available under the MIT

spookybot's People

Contributors

damn-dvlpr avatar hannesfant avatar illusi0nary avatar lucasctrl avatar marc2332 avatar matteoauger avatar mgomez08 avatar mjyao avatar mr1bitl8r avatar mralanlee avatar olvrmei avatar pervolarakis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spookybot's Issues

Dockerisation and automation for deployment

The entire bot is currently deployed by hand.

To reduce the entire workflow and make it easier to enable new features we are planning to bring everything together into a docker environment incl. github actions

This will be released soon! :-)

Improved command display

Feature Request

Improvement of message rendering, modification of the bot <-> user interaction system, improvement of the setlang command to make it more understandable.

Details
This issue is for information purposes only, please refer to the branch.

Feature Extension HBS: Remove the public message after a configurable time

Feature Extension of the Halloween Bot Scare (HBS)
Currently the bot sends you a message if you are not present in a voice channel. This message remains in the channel forever.

Details
If you request the bot to scare you and your companions and you are not present in a voice channel it is writing you a reply message. This reply message should be deleted after a configurable time in order to prevent the bot from spamming a discord channel.

Edit:
The message can also be used as a DM instead of a global present message. (as suggested by @ALMerrill )

Add spanish language file

Feature Request

Is your feature request related to a problem? Please describe.
I wanted to add a Spanish language file copying the English words to Spanish

Describe the solution you'd like
I added a Spanish file, with the addition of some extra words that also have the same meaning.

Teachability, Documentation, Adoption, Migration Strategy
It looks like just adding the file will allow it work one the PR is merged

PR: LucasCtrl/SpookyBot#3

Use multiple words for the same emoji

Feature Request

Describe the solution you'd like
To avoid having to create several objects for the same emoji, why not use an array containing all the words?

New translation file structure
Before:

{
  name: 'halloween',
  emoji: '๐ŸŽƒ',
},
{
  name: 'pumpkin',
  emoji: '๐ŸŽƒ',
}

After:

{
  name: ['halloween', 'pumpkin'],
  emoji: '๐ŸŽƒ',
}

Feature Extension HBS: Create a anti-spam protection for the command

Feature Extension of the Halloween Bot Scare (HBS)
Currently you can spam the command as often as you want. In order to prevent spamming we want to have an anti-spam protection. The protection should prevent a single user from using the command too often in a configurable time span.

Details
The bot remembers who requested a scare request and has a configurable time duration how long and how often a user can get the bot into the channel.
If the user exceeds that limit the bot simpy ingores that user command.

Contributing Request

Could I contribute to this project?

I would like to add a command that calculates the amount of time you have to wait for a PR to be matured when given a PR start date.

I am also open to coding whatever commands you need.

Make the prefix configurable

Feature Request

Is your feature request related to a problem? Please describe.
Making the prefix configurable allows the server admin to personalize it.

Describe the solution you'd like
Store the prefix in the database per server. If no prefix is configured, use the default one. Validate the prefix for the format prefixName!.

Describe alternatives you've considered
None ๐Ÿค”

Teachability, Documentation, Adoption, Migration Strategy

config: {
    command: 'setprefix',
    name: 'Set bot prefix',
    description: 'Change the default bot prefix',
    usage: `${prefix}setprefix <prefix>`,
    displayHelp: true,
    permissionNeeded: 'ADMINISTRATOR',
  },

Add support for the Dutch language

Feature Request

Is your feature request related to a problem? Please describe.
I would like to add support for the Dutch language

Describe the solution you'd like
Adding a nl.js file with the necessary words should do the trick.

Describe alternatives you've considered

Teachability, Documentation, Adoption, Migration Strategy
It should automatically work

Decouple emojis from individual language files to avoid merging overhead

Feature Request

Is your feature request related to a problem? Please describe.
One thing that might become a problem in combination with #10 and #12 is that people for different languages add new emojis in a different language file and order.
For example the https://github.com/LucasCtrl/spookyBot/blob/main/lang/en.js is missing the "Muerte" emoji from https://github.com/LucasCtrl/spookyBot/blob/main/lang/es.js

--> The English template file does not contain all possible halloweenish emojis from all language files so it makes life a little bit harder for people to keep track and who just want to add translations instead of searching for new emojis. The problem complexity increases with more languages and emojis being added... As long as there are not that many items it is probably doable for the person accepting a pull request to merge the changes back into the English template file but in the meantime other people might have added a new language and did work on an old template.

Describe the solution you'd like
So maybe it is a good idea to decouple the language files from the emojis and just use them for translations and maybe synonyms.

For example somebody could first search for a lot of halloweenish emojis, add them to a template and add a unique word/term to it which can be referenced uniquely in language files or maybe directly use the term as a filename for synonyms/translations and using a folder, e.g. "lang/en" for synonms, "lang/fr" for French translations, "lang/de" for "German", ... .
In a file lang/emojis,js you could then store the emojis + a unique word that describes each emoji, currently possible language and maybe have a tool that generates empty template files (e.g. in JSON format) for each possible language - or just have a folder with empty templates that can be copied directly, so e.g. for the "zombie" emoji it would generate a file called "zombie.json" in each of the language folders, so the structure then would look like this:
lang/
lang/_languagefiles_templates/candy.json
lang/_languagefiles_templates/zombie.json
lang/de/candy.json
lang/de/zombie.json
lang/en/candy.json
lang/en/zombie.json
lang/fr/candy.json
lang/fr/zombie.json
lang/nl/candy.json
lang/nl/zombie.json
[...]

And people would just need to fill in translations or for English just synonyms. If a template file is not filled with data it does not get used by the application in that language. (My assumption there is though that there are less emojis for Halloween to use than possible languages in which the discord bot will be adopted in.)
If programmed dynamically it could also easily be possible to based on the folder structure just adding a new language by adding a new folder with those files

Describe alternatives you've considered

  1. Instead of using the above mentioned solution with different folders and individual files it might just be easier to use one translation file for each language (sort of a mini dictionary for mapping the unique term to synonyms and translations).

  2. An alternative solution for solving the problem without a lot of manual merging work is to create an issue in which somebody pre-fills the English template with a lot of potentially Halloween emojis so that people start with (nearly) all the emojis right away and not worry with merging overhead in the future.

Teachability, Documentation, Adoption, Migration Strategy
If you can, explain how users will be able to use this and possibly write out a version the docs.
Maybe a screenshot or design?

  • With the above mentioned approaches it should be easier to integrate new languages and keep track of newly added emojis.

Adding Docker to the project

Feature Request

Is your feature request related to a problem? Please describe.
Consistent environment deployments or execution by adding Docker.

Describe the solution you'd like
Dockerizing the project.

Feature: Halloween Bot Scare

Feature Request

Is your feature request related to a problem? Please describe.
The bot reacts to the command boo!booh and joins your current voice channel and plays randomly a sound to scare you and your companions in the channel. A real laughter for everyone who is present in the channel! There is for the MVP Feature no spam protection nor queuing implemented.

Describe the solution you'd like
The MVP is already implemented. The command is added and the behaviour is also present.

Describe alternatives you've considered
As extensions which would be good #hacktoberfest issues:
Create a queue for the Bot
Create a anti-spam protection (each user can use it max 3 times in 10 minutes i.e.)
Create an interface to upload custom sounds to the Bot

Teachability, Documentation, Adoption, Migration Strategy
The use is with a special command ${prefix}!booh - after that the bot joins the voice channel you are currently present in and plays a sound. After the playback is finished the bot disappeared like a ghost! ๐Ÿ‘ป

React when mention someone

Feature Request

It might be nice to get the bot to react to messages when someone is mentioned.

Details
The robot should react to the message when a person is mentioned. However, the username of the person on the server must contain spooky.
It is also necessary to be careful that it is not the person's tag but his username that is taken into consideration.
e.g.: LucasAlt#7887 is my tag but my username on some servers is SpookyAlt

Feature Extension HBS: Add a queue for the requested scares

Feature Extension of the Halloween Bot Scare (HBS)
Currently the bot joins the voice channel and plays a sound and leaves the channel. In order to not interrupt the bot while playing a sound we need a queue for the requested scares.

Details
If the bot joins a channel (first in queue), it plays the sound and joins the next queued participant in order to play his scary sounds in that channel. If the queue is completed the bot leaves the voice-communication and idles and waits for new victims.

Multiple language on the same server

Feature Request

Is your feature request related to a problem? Please describe.
It would be nice to be able to use several languages on the same server.
e.g.: French, English and Spanish language

Wrong informations

Bug Report

Current Behavior
The information displayed in the user activity section is not correct when referring to the console.

Data in the console
image
Data displayed in the activity section:

  • 1 server
  • 3 users

Multi-words filter

Bug Report

Current Behavior
In a translation file, multi-part words are not taken into account.
e.g.: "abend vor allerheiligen" will not be detected

Possible Solution
Change the operating principle of the filter. For the moment, the message is split after each space. Then the different words are compared against the words in the translation file.

Issue starting project, typo on filename

Bug Report

Current Behavior
yarn start outputs the following error:

yarn run v1.22.4
$ node code.js
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '/app/code.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Possible Solution
https://github.com/LucasCtrl/spookyBot/blob/703622101188836e0ed6d11ca445e5eeddc2b373/package.json#L23

This should be core.js instead of code.js

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.