Skip to content

Commit

Permalink
Narlin
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroGizmo committed Jul 13, 2022
0 parents commit 31d511a
Show file tree
Hide file tree
Showing 21 changed files with 3,280 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true
},
"plugins": ["security"],
"extends": ["eslint:recommended", "plugin:security/recommended"],
"ignorePatterns": ["temp.js", "**/dist/*.js"],
"parserOptions": {
"ecmaVersion": 12
},
"rules": {}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 enjoyablee

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { Intents } = require("discord.js");

const config = {
bot: {
token: process.env.TOKEN,
intents: [], // You can find the available intents on https://discord.js.org/#/docs/main/stable/class/Intents?scrollTo=s-FLAGS
guildId: "", // Update this field to only register commands a guild, this will make the commands to load instantly in the selected gulld (Optional)
},
};

module.exports = config;
51 changes: 51 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
require('dotenv').config()
const url = "mongodb://Warns:warn@192.168.1.134:27017/Warns"
const mongoose = require('mongoose');
mongoose.connect(url, {
useNewUrlParser: true,
useUnifiedTopology: true
})
// Util
const ora = require('ora')
const config = require('./config')
const fs = require('fs')

// Slash Commands
const { Client, Collection } = require('discord.js')
const slash = require('./src/util/slash')
const { builtinModules } = require('module')

// CLI
const intentsLoader = ora('Registering Intents').start()

// Checks
let finalIntents = []
if (!Array.isArray(config.bot.intents)) {
intentsLoader.warn(
'Intents in config file must be in an array, default intents will be used'
)
} else {
finalIntents = config.bot.intents
intentsLoader.succeed('Loaded intents successfully from the config file')
}

const client = new Client({ intents: finalIntents })
module.exports = client;

// Commands
client.commands = new Collection()

const events = fs
.readdirSync('./src/events')
.filter(file => file.endsWith('.js'))

events.forEach(event => {
const eventFile = require(`./src/events/${event}`)
if (eventFile.oneTime) {
client.once(eventFile.event, (...args) => eventFile.run(...args))
} else {
client.on(eventFile.event, (...args) => eventFile.run(...args))
}
})

client.login(config.bot.token)
6 changes: 6 additions & 0 deletions models/statusModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const mongoose = require('mongoose');
const statusSchema = mongoose.Schema({
status: String,
})

module.exports = mongoose.model('Status', statusSchema);
10 changes: 10 additions & 0 deletions models/warnModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const mongoose = require('mongoose');
const warnSchema = mongoose.Schema({
userId: String,
guildId: String,
moderatorId: String,
reason: String,
timestamp: String,
})

module.exports = mongoose.model('Warn', warnSchema);
Loading

0 comments on commit 31d511a

Please sign in to comment.