This repository has been archived by the owner on Jan 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from EliasSchaut/dev
Dev
- Loading branch information
Showing
50 changed files
with
5,777 additions
and
48 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
handler/slash_commands/option_models/lang.js → ...ndler/slash_handler/option_models/lang.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// See also: https://github.com/EliasSchaut/Discord-Bot-Template/wiki/How-to-command | ||
|
||
const { get_text: gt } = require("../../lang/lang_helper") | ||
const s = "commands.<name>." | ||
|
||
module.exports = { | ||
name: '<name>', | ||
description: async function (msg) { return await gt(msg, s + "help") }, | ||
aliases: ['<alias_1>', '<alias_2>'], | ||
args_needed: false, | ||
args_min_length: 0, | ||
args_max_length: 0, | ||
usage: async function (msg) { return await gt(msg, s + "usage") }, | ||
guild_only: false, | ||
dm_only: false, | ||
need_permission: ['<permission1>', '<permission2>'], | ||
admin_only: false, | ||
nsfw: false, | ||
disabled: false, | ||
enable_slash: false, | ||
async execute(msg, args) { // msg = discord.js 'Message' object; args = given arguments as list | ||
// your lovely code to execute | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// See also: https://github.com/EliasSchaut/Discord-Bot-Template/wiki/How-to-database | ||
// Sequelize-Types: https://sequelize.org/v5/manual/data-types.html | ||
// Examples: https://discordjs.guide/sequelize/ | ||
|
||
// --------------------------------------------- | ||
// Model | ||
// --------------------------------------------- | ||
const _TABLE = (sequelize, Sequelize) => { | ||
return sequelize.define('<NAME>', { | ||
"<attribute1>": { | ||
type: "<Sequelize-Type>", | ||
unique: true, | ||
}, | ||
"<attribute2>": "<Sequelize-Type>", | ||
}, { | ||
timestamp: false | ||
}) | ||
} | ||
// --------------------------------------------- | ||
|
||
|
||
// --------------------------------------------- | ||
// Helper | ||
// --------------------------------------------- | ||
// add stuff to database | ||
async function add(msg) { | ||
try { | ||
await msg.client.DB["<NAME>"].TABLE.create({ | ||
"<attribute1>": "<value1>", | ||
"<attribute2>": "<value2>" | ||
}) | ||
|
||
} catch (e) { | ||
if (e.name === 'SequelizeUniqueConstraintError') { | ||
msg.client.logger.log("warn",`<value> already exist in database!`) | ||
|
||
} else { | ||
msg.client.logger.log("error",`Something went wrong with adding this <values> in database!`) | ||
} | ||
} | ||
} | ||
|
||
// get stuff from database | ||
async function get(msg) { | ||
const tag = await msg.client.DB["<NAME>"].TABLE.findOne({ where: { "<attribute1>": "<value1>" } }) | ||
|
||
if (tag) { | ||
return tag.lang | ||
|
||
} else { | ||
msg.client.logger.log("warn",`<value> not in database!`) | ||
await add(msg) | ||
return await get(msg) | ||
} | ||
} | ||
|
||
|
||
// set stuff in database | ||
async function set(msg) { | ||
const new_tag = await msg.client.DB["<NAME>"].TABLE.update({ "<attribute2>": "<value3>" }, { where: { "<attribute1>": "<value1>" } }) | ||
|
||
if (new_tag) { | ||
return true | ||
|
||
} else { | ||
msg.client.logger.log("error", `Could not set <attribute2>!`) | ||
return false | ||
} | ||
} | ||
|
||
// remove tag in database | ||
async function remove(msg) { | ||
const rowCount = await msg.client.DB["<NAME>"].TABLE.destroy({ where: { "<attribute1>": "<value1>" } }) | ||
|
||
if (rowCount) { | ||
return true | ||
|
||
} else { | ||
msg.client.logger.log("error", `Could not delete tag with <attribute1>!`) | ||
return false | ||
} | ||
} | ||
// --------------------------------------------- | ||
|
||
|
||
module.exports = { _TABLE, add, get, set, remove } |
Oops, something went wrong.