Skip to content

Commit

Permalink
πŸ”– v2.1.0
Browse files Browse the repository at this point in the history
[RELEASE] - v2.1.0
  • Loading branch information
LucasCtrl authored Oct 16, 2021
2 parents 5bbba61 + 5b3f06d commit b567355
Show file tree
Hide file tree
Showing 20 changed files with 580 additions and 128 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/---emoji-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "Emoji request"
about: "I would like to add a new emoji in the list"
title: ''
labels: question
assignees: ''
---

## Emoji request

**Emoji:**
**Potential ID(s):**
49 changes: 41 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,63 @@
## How to contribute to SpookyBot
# How to contribute to SpookyBot

#### **Did you find a bug?**
## **Did you find a bug?**

* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/LucasCtrl/spookyBot/issues).

* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/LucasCtrl/spookyBot/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.

#### **Did you write a patch that fixes a bug?**
## **Did you write a patch that fixes a bug?**

* Open a new GitHub pull request with the patch.

* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
## **Did you fix whitespace, format code, or make a purely cosmetic patch?**

Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of the bot will generally not be accepted.

#### **Do you intend to add a new feature or change an existing one?**
## **Do you intend to add a new feature or change an existing one?**

* Suggest your change in a [GitHub issue](https://github.com/LucasCtrl/spookyBot/issues) and start writing code.

#### **Do you have questions about the source code or the bot?**
## **Do you have questions about the source code or the bot?**

* Ask any question about SpookyBot on our [Discord server](https://discord.gg/nEDcagb).


## **Branches naming convention**

Your branches should be named as follows:
`type/camelCase`

* **type**: represent the type of your feature, follow the following table
* **camelCase**: your feature title in [camelCase aka dromedaryCase](https://en.wikipedia.org/wiki/Camel_case) (e.g.: `addReactions`, `i18nIntegration`, `us`, `es`)

If your branch does not follow this naming standard, your PR may be rejected.

### Branch types

| Type | Usage |
| ----- | ----- |
| feature | Used when developing a new feature |
| fix | Used to solve a bug |
| translation | Used to translate the robot |

## **Pull requests/Issues naming convention**

Your PRs and issues should be named as follows:
`[TYPE] - PR title`

* **TYPE**: represent the type of your feature, follow the following table
* **PR title**: your PR title

### PR types

| Type | Usage |
| ----- | ----- |
| FEATURE | Used when developing a new feature |
| BUG | Used to solve a bug |
| TRANSLATION | Used to translate the robot |


Thanks! :heart: :heart: :heart:

LucasAlt
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,10 @@ This project is convenient for people who want to get into open source and contr

You just need to click on [this link](https://discord.com/oauth2/authorize?client_id=761568927188123669&scope=bot&permissions=380108139840) and validate the form without changing any permission.

<!-- ## 🌐 Adding a language
## 🌐 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](http://www.mathguide.de/info/tools/languagecode.html).
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](https://github.com/LucasCtrl/SpookyBot/blob/main/README.md#-contributing).
To react to a word, you need two elements in the translation file: the word and the emoji with which it will react.
```json
{
"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](https://discordjs.guide/popular-topics/reactions.html#custom-emojis). -->
[Follow the dedicated wiki page](https://github.com/LucasCtrl/SpookyBot/wiki/i18n).

<!-- ## πŸ’» Testing locally
1. Create a bot [on the Discord developer portal](https://discord.com/developers/applications),
Expand Down Expand Up @@ -72,7 +59,7 @@ Or with `docker compose up` -->

## 🀝 Contributing

Before contributing to this project, make sure you have read the [contribution guidelines](https://github.com/LucasCtrl/SpookyBot/blob/main/CONTRIBUTING.md)!
Before contributing to this project, make sure you have read the [contribution guidelines](https://github.com/LucasCtrl/SpookyBot/blob/dev/CONTRIBUTING.md)!

1. Fork it (https://github.com/LucasCtrl/SpookyBot/fork)
2. Create your feature branch (`git checkout -b feature/fooBar`)
Expand Down
73 changes: 73 additions & 0 deletions commands/Configuration/setlang.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { MessageEmbed } from 'discord.js'
import { readdirSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { languageCodes as ISOCode } from '../../utils/languageCodes.js'
import { updateGuildConfig } from '../../models/guilds/config.js'

export default {
command: 'setlang',
aliases: ['lang'],
help: {
name: 'Set language',
description: 'Change bot default language',
},

run: async (client, message, args) => {
message.delete()

let availableLang = []
let embed

// -------------------- Get available languages --------------------

const __dirname = dirname(fileURLToPath(import.meta.url))
readdirSync(resolve(__dirname, `../../lang/`))
.filter((x) => x.endsWith('.js'))
.forEach((file) => {
availableLang.push(file.slice(0, -3))
})

// -------------------- Display help if no language provided --------------------
if (args.length == 0) {
embed = new MessageEmbed()
.setColor(client.config.colors.primary)
.setAuthor('How to use the command', client.user.avatarURL())
.setDescription(`\`${client.config.prefix}setlang <lang>\``)
.setFooter('This message will be deleted automatically')
}

// -------------------- Change language if exist --------------------
else if (availableLang.find((lang) => lang == args[0])) {
embed = new MessageEmbed()
.setColor(client.config.colors.primary)
.setAuthor('Default language changed', client.user.avatarURL())
.setDescription(`Language set to: **${args[0]}**`)
.setFooter('This message will be deleted automatically')

updateGuildConfig(message.guild.id, { lang: args[0] })
}

// -------------------- Display help if not exist --------------------
else {
let messageDescription = [
'The requested language does not exist, please choose a language from this list: (the bold part)',
]
availableLang.forEach((lang) =>
messageDescription.push(`- **${lang}**: ${ISOCode.find((l) => l.code == lang).name}`)
)

embed = new MessageEmbed()
.setColor(client.config.colors.primary)
.setAuthor('Language not found', client.user.avatarURL())
.setDescription(messageDescription.join('\n'))
.setFooter(
"If you can't find your language, don't hesitate to contact us by using the command boo!support | This message will be deleted automatically"
)
}

message.channel.send({ embeds: [embed] }).then((m) => {
setTimeout(() => m.delete(), 20000)
})
},
}
4 changes: 2 additions & 2 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from 'discord.js'
import { createEvent } from '../models/events.js'
import { createEvent } from '../models/analitycs/events.js'
import currentDate from '../utils/currentDate.js'

export default (client, webhook, guild) => {
Expand All @@ -9,5 +9,5 @@ export default (client, webhook, guild) => {
.setFooter(currentDate())

webhook.send({ embeds: [embed] })
createEvent('guildCreate')
createEvent('guildCreate').catch((err) => console.log('Error while creating the guildCreate event document: ', err))
}
4 changes: 2 additions & 2 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from 'discord.js'
import { createEvent } from '../models/events.js'
import { createEvent } from '../models/analitycs/events.js'
import currentDate from '../utils/currentDate.js'

export default (client, webhook, guild) => {
Expand All @@ -12,5 +12,5 @@ export default (client, webhook, guild) => {
.setFooter(currentDate())

webhook.send({ embeds: [embed] })
createEvent('guildDelete')
createEvent('guildDelete').catch((err) => console.log('Error while creating the guildDelete event document: ', err))
}
14 changes: 10 additions & 4 deletions events/messageCreate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from 'discord.js'
import { createCommand } from '../models/commands.js'
import { createCommand } from '../models/analitycs/commands.js'
import reactMessage from '../utils/reactMessage.js'
import currentDate from '../utils/currentDate.js'

Expand Down Expand Up @@ -27,12 +27,18 @@ export default async (client, webhook, message) => {
.setFooter(currentDate())
webhook.send({ embeds: [embed] })

createCommand(cmd.command)
createCommand(cmd.command).catch((err) => console.log('Error while creating the command document: ', err))

return cmd.run(client, message)
return cmd.run(client, message, args)
}

// -------------------- Messages without prefix --------------------

reactMessage(client, message, webhook)
if (
message.channel.permissionsFor(client.user).has(['USE_EXTERNAL_EMOJIS']) &&
message.channel.permissionsFor(client.user).has(['ADD_REACTIONS'])
) {
// Check if the bot has the permission to react and use external emojis
reactMessage(client, message, webhook)
}
}
4 changes: 2 additions & 2 deletions events/ready.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MessageEmbed } from 'discord.js'
import { createEvent } from '../models/events.js'
import { createEvent } from '../models/analitycs/events.js'
import currentDate from '../utils/currentDate.js'

export default (client, webhook) => {
Expand All @@ -12,5 +12,5 @@ export default (client, webhook) => {
.setFooter(currentDate())

webhook.send({ embeds: [embed] })
createEvent('ready')
createEvent('ready').catch((err) => console.log('Error while creating the ready event document: ', err))
}
2 changes: 1 addition & 1 deletion handlers/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async (client) => {
}
}

const dirs = ['Info']
const dirs = ['Configuration', 'Info']

if (process.env.NODE_ENV == 'dev') dirs.push('Development')

Expand Down
67 changes: 67 additions & 0 deletions lang/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
export const emojis = [
{
id: 'spookybot',
emoji: '761602615326146590',
words: ['spooky'],
},
{
id: 'bat',
emoji: 'πŸ¦‡',
words: ['bat'],
},
{
id: 'bone',
emoji: '🦴',
words: ['bone'],
},
{
id: 'brain',
emoji: '🧠',
words: ['brain'],
},
{
id: 'broom',
emoji: '🧹',
words: ['broom'],
},
{
id: 'candy',
emoji: '🍬',
words: ['candy'],
},
{
id: 'ghost',
emoji: 'πŸ‘»',
words: ['ghost'],
},
{
id: 'lollipop',
emoji: '🍭',
words: ['lollipop'],
},
{
id: 'pumpkin',
emoji: 'πŸŽƒ',
words: ['halloween', 'pumpkin'],
},
{
id: 'skull',
emoji: 'πŸ’€',
words: ['skull'],
},
{
id: 'vampire',
emoji: 'πŸ§›',
words: ['vampire'],
},
{
id: 'witch',
emoji: 'πŸ§™β€β™€οΈ',
words: ['witch'],
},
{
id: 'zombie',
emoji: 'πŸ§Ÿβ€β™‚οΈ',
words: ['zombie'],
},
]
Loading

0 comments on commit b567355

Please sign in to comment.