-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Discord.js v13 embed structure
- Loading branch information
Derek
committed
Aug 20, 2021
1 parent
c153f62
commit 9134545
Showing
63 changed files
with
1,324 additions
and
655 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,143 +1,149 @@ | ||
// Copyright 2020 Cytrus-RE Developers | ||
// You may use the code, but please do credit us. | ||
|
||
"use strict"; | ||
"use strict" | ||
|
||
// Check if the Node version is 12+ | ||
if (Number(process.version.slice(1).split(".")[0]) < 12) throw new Error("Tsuyo requires Node 12 or higher. Re-run the bot with Node 12 or higher."); | ||
if (Number(process.version.slice(1).split(".")[0]) < 16) throw new Error("Tsuyo requires Node v16 or higher. Re-run the bot with Node v16 or higher.") | ||
require("dotenv").config({ | ||
path: ".env" | ||
}) | ||
if (process.env.PREBOOT) eval(process.env.PREBOOT); // Execute anything in the preboot variable | ||
if (process.env.PREBOOT) eval(process.env.PREBOOT) // Execute anything in the preboot variable | ||
|
||
// Define NPM modules | ||
const Discord = require("discord.js"); | ||
const Enmap = require("enmap"); | ||
const { | ||
Client, | ||
Collection, | ||
Intents | ||
} = require("discord.js") | ||
|
||
const Enmap = require("enmap") | ||
const { | ||
ReactionRole | ||
} = require("reaction-role"); | ||
} = require("reaction-role") | ||
|
||
// Define client | ||
const client = new Discord.Client({ | ||
const client = new Client({ | ||
disableEveryone: true, | ||
disabledEvents: ["TYPING_START"] | ||
}); | ||
disabledEvents: ["TYPING_START"], | ||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] | ||
}) | ||
|
||
// Define time of startup | ||
client.starttime = new Date(); | ||
client.starttime = new Date() | ||
|
||
// Define databases/objects | ||
client.profiles = new Enmap({ | ||
name: "profiles" | ||
}); | ||
}) | ||
client.logins = new Enmap({ | ||
name: "logins" | ||
}); | ||
}) | ||
client.spotify = new Enmap({ | ||
name: "spotify" | ||
}); | ||
}) | ||
client.settings = new Enmap({ | ||
name: "settings" | ||
}); | ||
}) | ||
client.notes = new Enmap({ | ||
name: "notes" | ||
}); | ||
}) | ||
client.bugs = new Enmap({ | ||
name: "bugreports" | ||
}); | ||
}) | ||
client.starboard = new Enmap({ | ||
name: "starboardmid" | ||
}); | ||
}) | ||
client.warns = new Enmap({ | ||
name: "warns" | ||
}); | ||
}) | ||
client.tags = new Enmap({ | ||
name: "tags" | ||
}); | ||
}) | ||
client.points = new Enmap({ | ||
name: "points" | ||
}); | ||
}) | ||
client.pings = new Enmap({ | ||
name: "pings" | ||
}); | ||
}) | ||
client.pingwords = new Enmap({ | ||
name: "pingwords" | ||
}); | ||
}) | ||
client.inventory = new Enmap({ | ||
name: "inventory" | ||
}); | ||
}) | ||
client.garden = new Enmap({ | ||
name: "garden" | ||
}); | ||
}) | ||
client.money = new Enmap({ | ||
name: "money" | ||
}); | ||
}) | ||
client.cooldown = new Enmap({ | ||
name: "cooldown" | ||
}); | ||
}) | ||
client.badges = new Enmap({ | ||
name: "badges" | ||
}); | ||
}) | ||
client.reputation = new Enmap({ | ||
name: "reputation" | ||
}); | ||
}) | ||
client.fish = new Enmap({ | ||
name: "fish" | ||
}); | ||
}) | ||
client.flags = new Enmap({ | ||
name: "flags" | ||
}); | ||
}) | ||
client.badges = new Enmap({ | ||
name: "badges" | ||
}); | ||
}) | ||
client.money = new Enmap({ | ||
name: "money" | ||
}); | ||
}) | ||
client.profile = new Enmap({ | ||
name: "profile" | ||
}); | ||
}) | ||
client.life = new Enmap({ | ||
name: "life" | ||
}); | ||
}) | ||
client.tags = new Enmap({ | ||
name: "tags" | ||
}); | ||
}) | ||
client.uses = new Enmap({ | ||
name: "commandpop" | ||
}); | ||
}) | ||
|
||
client.commands = new Discord.Collection(); | ||
client.aliases = new Discord.Collection(); | ||
client.liusers = new Discord.Collection(); | ||
client.music = {}; | ||
client.levelCache = {}; | ||
client.commands = new Collection() | ||
client.aliases = new Collection() | ||
//client.users = new Collection() | ||
client.music = {} | ||
client.levelCache = {} | ||
|
||
// Import files | ||
client.logger = require("./modules/logger"); | ||
client.config = require("./config"); | ||
client.errors = require("./modules/errors"); | ||
client.logger = require("./modules/logger") | ||
client.config = require("./config") | ||
client.errors = require("./modules/errors") | ||
|
||
require("./modules/commands")(client); // Import command module | ||
require("./modules/events")(client); // Import events module | ||
require("./modules/_functions")(client); // Import functions | ||
require("./modules/webhooks")(client); // Import functions | ||
require("./modules/commands")(client) // Import command module | ||
require("./modules/events")(client) // Import events module | ||
require("./modules/_functions")(client) // Import functions | ||
require("./modules/webhooks")(client) // Import functions | ||
|
||
// Cache the permissions | ||
for (let i = 0; i < client.config.permLevels.length; i++) { | ||
let currentlevel = client.config.permLevels[i]; | ||
client.levelCache[currentlevel.name] = currentlevel.level; | ||
let currentlevel = client.config.permLevels[i] | ||
client.levelCache[currentlevel.name] = currentlevel.level | ||
} | ||
|
||
process.env.SESSION_SECRET = ""; | ||
process.env.SESSION_SECRET = "" | ||
for (let i = 0; i <= 1500; i++) { | ||
process.env.SESSION_SECRET += | ||
Math.random().toString(16).slice(2, 8).toUpperCase().slice(-6) + i; | ||
Math.random().toString(16).slice(2, 8).toUpperCase().slice(-6) + i | ||
} | ||
|
||
client.login(process.env.BOT_TOKEN); | ||
console.log("Logged into Discord API!"); | ||
client.login(process.env.BOT_TOKEN) | ||
console.log("Logged into Discord API!") | ||
|
||
const ReactionRoles = new ReactionRole(process.env.BOT_TOKEN, process.env.MONGODB_URI); | ||
ReactionRoles.init(); | ||
//const ReactionRoles = new ReactionRole(process.env.BOT_TOKEN, process.env.MONGODB_URI) | ||
//ReactionRoles.init() | ||
|
||
module.exports = client; | ||
module.exports = client |
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
Oops, something went wrong.