Added base project files.

This commit is contained in:
Toastie 2024-07-05 00:05:34 +12:00
parent 396a8adf72
commit 62976908f2
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
12 changed files with 4232 additions and 0 deletions

9
.dockerignore Normal file
View file

@ -0,0 +1,9 @@
.DS_Store
node_modules/
.git/
.vscode/
docs/
*.log
*.tar.gz
*.tar
.env

24
.env.example Normal file
View file

@ -0,0 +1,24 @@
@@ -1,23 +0,0 @@
# Bot Token [Required]
BOT_TOKEN=
# Mongo Database Connection String [Required]
MONGO_CONNECTION=
# Webhooks [Optional]
ERROR_LOGS=
JOIN_LEAVE_LOGS=
# Dashboard [Required for dashboard]
BOT_SECRET=
SESSION_PASSWORD=
# Required for Weather Command (https://weatherstack.com)
WEATHERSTACK_KEY=
# Required for image commands (https://strangeapi.fun/docs)
STRANGE_API_KEY=
# SPOTFIY [Required for Spotify Support]
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=

24
.eslintrc.json Normal file
View file

@ -0,0 +1,24 @@
{
"env": {
"node": true,
"commonjs": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
},
"plugins": [
"jsdoc"
],
"rules": {
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"jsdoc/no-undefined-types": 1,
"no-cond-assign": 0
}
}

8
.gitattributes vendored Normal file
View file

@ -0,0 +1,8 @@
# Files that shouldn't be exported
.gitattributes export-ignore
.gitignore export-ignore
.vscode export-ignore
README.md export-ignore
# Line endings
* text=auto

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
.DS_Store
.vscode/
node_modules/
*.log
*.tar.gz
.env

11
.prettierrc.json Normal file
View file

@ -0,0 +1,11 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"printWidth": 120,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf"
}

134
config.js Normal file
View file

@ -0,0 +1,134 @@
module.exports = {
OWNER_IDS: [""], // Bot owner ID's
SUPPORT_SERVER: "", // Your bot support server
PREFIX_COMMANDS: {
ENABLED: true, // Enable/Disable prefix commands
DEFAULT_PREFIX: "!", // Default prefix for the bot
},
INTERACTIONS: {
SLASH: false, // Should the interactions be enabled
CONTEXT: false, // Should contexts be enabled
GLOBAL: false, // Should the interactions be registered globally
TEST_GUILD_ID: "xxxxxxxxxxx", // Guild ID where the interactions should be registered. [** Test you commands here first **]
},
EMBED_COLORS: {
BOT_EMBED: "#068ADD",
TRANSPARENT: "#36393F",
SUCCESS: "#00A56A",
ERROR: "#D61A3C",
WARNING: "#F7E919",
},
CACHE_SIZE: {
GUILDS: 100,
USERS: 10000,
MEMBERS: 10000,
},
MESSAGES: {
API_ERROR: "Unexpected Backend Error! Try again later or contact support server",
},
// PLUGINS
AUTOMOD: {
ENABLED: false,
LOG_EMBED: "#36393F",
DM_EMBED: "#36393F",
},
DASHBOARD: {
enabled: false, // enable or disable dashboard
baseURL: "http://localhost:8080", // base url
failureURL: "http://localhost:8080", // failure redirect url
port: "8080", // port to run the bot on
},
ECONOMY: {
ENABLED: false,
CURRENCY: "₪",
DAILY_COINS: 100, // coins to be received by daily command
MIN_BEG_AMOUNT: 100, // minimum coins to be received when beg command is used
MAX_BEG_AMOUNT: 2500, // maximum coins to be received when beg command is used
},
MUSIC: {
ENABLED: false,
IDLE_TIME: 60, // Time in seconds before the bot disconnects from an idle voice channel
MAX_SEARCH_RESULTS: 5,
DEFAULT_SOURCE: "SC", // YT = Youtube, YTM = Youtube Music, SC = SoundCloud
// Add any number of lavalink nodes here
// Refer to https://github.com/freyacodes/Lavalink to host your own lavalink server
LAVALINK_NODES: [
{
host: "localhost",
port: 2333,
password: "youshallnotpass",
id: "Local Node",
secure: false,
},
],
},
GIVEAWAYS: {
ENABLED: false,
REACTION: "🎁",
START_EMBED: "#FF468A",
END_EMBED: "#FF468A",
},
IMAGE: {
ENABLED: false,
BASE_API: "https://strangeapi.hostz.me/api",
},
INVITE: {
ENABLED: false,
},
MODERATION: {
ENABLED: false,
EMBED_COLORS: {
TIMEOUT: "#102027",
UNTIMEOUT: "#4B636E",
KICK: "#FF7961",
SOFTBAN: "#AF4448",
BAN: "#D32F2F",
UNBAN: "#00C853",
VMUTE: "#102027",
VUNMUTE: "#4B636E",
DEAFEN: "#102027",
UNDEAFEN: "#4B636E",
DISCONNECT: "RANDOM",
MOVE: "RANDOM",
},
},
PRESENCE: {
ENABLED: false, // Whether or not the bot should update its status
STATUS: "online", // The bot's status [online, idle, dnd, invisible]
TYPE: "WATCHING", // Status type for the bot [PLAYING | LISTENING | WATCHING | COMPETING]
MESSAGE: "{members} members in {servers} servers", // Your bot status message
},
STATS: {
ENABLED: false,
XP_COOLDOWN: 5, // Cooldown in seconds between messages
DEFAULT_LVL_UP_MSG: "{member:tag}, You just advanced to **Level {level}**",
},
SUGGESTIONS: {
ENABLED: false, // Should the suggestion system be enabled
EMOJI: {
UP_VOTE: "⬆️",
DOWN_VOTE: "⬇️",
},
DEFAULT_EMBED: "#4F545C",
APPROVED_EMBED: "#43B581",
DENIED_EMBED: "#F04747",
},
TICKET: {
ENABLED: false,
CREATE_EMBED: "#068ADD",
CLOSE_EMBED: "#068ADD",
},
};

38
docker-compose.yml Normal file
View file

@ -0,0 +1,38 @@
version: "4"
services:
discord-js-bot:
image: toastie_t0ast/discord-bot:5.5.0
container_name: discord-js-bot
restart: unless-stopped
networks:
- discord-js-net
volumes:
- ./config.js:/usr/src/app/config.js:ro
- ./logs:/usr/src/app/logs:rw
lavalink:
image: fredboat/lavalink:dev
container_name: discord-js-lavalink
hostname: lavalink
restart: unless-stopped
networks:
- discord-js-net
volumes:
- ./application.yml:/opt/Lavalink/application.yml:ro
mongodb:
image: mongo:latest
container_name: discord-js-mongodb
restart: unless-stopped
networks:
- discord-js-net
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=supersecretpassword
volumes:
- ./data:/data/db:rw
networks:
discord-js-net:
name: discord-js-net

32
dockerfile Normal file
View file

@ -0,0 +1,32 @@
# Base image
FROM node:18-alpine
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json to the container
COPY package*.json ./
# Install only production dependencies
RUN npm ci --omit=dev
# Bundle rest of the source code
COPY . .
# Environment variables
ENV BOT_TOKEN=
ENV MONGO_CONNECTION=
ENV ERROR_LOGS=
ENV JOIN_LEAVE_LOGS=
ENV BOT_SECRET=
ENV SESSION_PASSWORD=
ENV WEATHERSTACK_KEY=
ENV STRANGE_API_KEY=
ENV SPOTIFY_CLIENT_ID=
ENV SPOTIFY_CLIENT_SECRET=
# Expose port 8080 for dashboard
EXPOSE 8080
# Define the command to run your Node.js application
CMD [ "node", "bot.js" ]

28
jsconfig.json Normal file
View file

@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES6",
"baseUrl": "./",
"paths": {
"@root/*": [
"./*"
],
"@handlers/*": [
"./src/handlers/*"
],
"@helpers/*": [
"./src/helpers/*"
],
"@schemas/*": [
"./src/database/schemas/*"
],
"@src/*": [
"./src/*"
],
"@structures/*": [
"./src/structures/*"
]
}
},
"exclude": ["node_modules", "**/node_modules/*"]
}

3835
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

83
package.json Normal file
View file

@ -0,0 +1,83 @@
{
"name": "discord-bot",
"version": "5.5.0",
"description": "An open-source, multipurpose discord bot built using discord.js",
"main": "bot.js",
"author": "toastie_t0ast",
"license": "ISC",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"dev": "nodemon .",
"start": "node .",
"format": "prettier --write src",
"docker:package": "tar -cf discord-bot.tar dashboard logs src bot.js config.js dockerfile package.json package-lock.json",
"docker:build": "docker build -t toastie_t0ast/discord-bot:5.5.0 ."
},
"homepage": "https://toastielab.dev/toastie_t0ast/discord-bot#readme",
"repository": {
"type": "git",
"url": "https://toastielab.dev/toastie_t0ast/discord-bot.git"
},
"bugs": {
"url": "https://toastielab.dev/toastie_t0ast/discord-bot/issues"
},
"dependencies": {
"@lavaclient/queue": "^2.1.1",
"@lavaclient/spotify": "^3.1.0",
"@vitalets/google-translate-api": "^9.2.0",
"ascii-table": "0.0.9",
"btoa": "^1.2.1",
"common-tags": "^1.8.2",
"connect-mongo": "^5.1.0",
"country-emoji-languages": "^1.0.0",
"discord-giveaways": "^6.0.1",
"discord-together": "^1.3.31",
"discord.js": "^14.11.0",
"dotenv": "^16.3.1",
"ejs": "^3.1.9",
"enhanced-ms": "^2.3.0",
"express": "^4.18.2",
"express-session": "^1.18.0",
"fixedsize-map": "^1.0.1",
"iso-639-1": "^3.1.0",
"lavaclient": "^4.1.1",
"module-alias": "^2.2.3",
"moment": "^2.30.1",
"mongoose": "^8.1.1",
"nekos.life": "^3.0.0",
"node-fetch": "^2.7.0",
"os": "^0.1.2",
"pino": "^8.18.0",
"pino-pretty": "^10.3.1",
"pretty-ms": "^7.0.1",
"snakecord": "^1.0.9",
"sourcebin_js": "^0.0.3-ignore",
"string-progressbar": "^1.0.4",
"table": "^6.8.1",
"timestamp-to-date": "^1.1.0",
"twemoji-parser": "^14.0.0"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"erlpack": "^0.1.4",
"utf-8-validate": "^6.0.3",
"zlib-sync": "^0.1.9"
},
"devDependencies": {
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^46.4.3",
"node": "^18.18.2",
"nodemon": "^3.0.3",
"prettier": "3.2.5"
},
"_moduleAliases": {
"@root": ".",
"@handlers": "src/handlers/",
"@helpers": "src/helpers/",
"@schemas": "src/database/schemas/",
"@src": "src/",
"@structures": "src/structures/"
}
}