commit
db54eab0ae
@ -0,0 +1 @@ |
||||
json/auth.json |
@ -0,0 +1,8 @@ |
||||
# Default ignored files |
||||
/shelf/ |
||||
/workspace.xml |
||||
# Editor-based HTTP Client requests |
||||
/httpRequests/ |
||||
# Datasource local storage ignored files |
||||
/dataSources/ |
||||
/dataSources.local.xml |
@ -0,0 +1,12 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="WEB_MODULE" version="4"> |
||||
<component name="NewModuleRootManager"> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/temp" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" /> |
||||
</content> |
||||
<orderEntry type="inheritedJdk" /> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
</component> |
||||
</module> |
@ -0,0 +1,7 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="DiscordProjectSettings"> |
||||
<option name="show" value="ASK" /> |
||||
<option name="description" value="" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,10 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="MaterialThemeProjectNewConfig"> |
||||
<option name="metadata"> |
||||
<MTProjectMetadataState> |
||||
<option name="userId" value="-253b1e6d:1980c899456:-7fe2" /> |
||||
</MTProjectMetadataState> |
||||
</option> |
||||
</component> |
||||
</project> |
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="MarkdownSettingsMigration"> |
||||
<option name="stateVersion" value="1" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectModuleManager"> |
||||
<modules> |
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Senko.iml" filepath="$PROJECT_DIR$/.idea/Senko.iml" /> |
||||
</modules> |
||||
</component> |
||||
</project> |
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="VcsDirectoryMappings"> |
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,45 @@ |
||||
const Discord = require('discord.js'); |
||||
|
||||
const errorhandler = require('./util/log/errorhandler'); |
||||
const log = require('./util/log/log'); |
||||
const wait = require('./util/misc/wait'); |
||||
|
||||
const flags = Discord.GatewayIntentBits; |
||||
const partials = Discord.Partials; |
||||
let fl = []; Object.keys(flags).forEach(flag => fl.push(flags[flag])); // fuck new standards i'm in't'zing with all the flags.
|
||||
const client = new Discord.Client({intents: fl, partials: [partials.Channel, partials.Message, partials.Reaction]}); |
||||
|
||||
let waitAmount = 1000 * 10; |
||||
function testConnection() { |
||||
return new Promise(async r => { |
||||
require('dns').lookup('www.google.com', async e => { |
||||
if (e) {await wait(waitAmount); waitAmount *= 2; await testConnection(); r();} |
||||
else {r();} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
|
||||
const startBot = async () => { |
||||
|
||||
client.config = require('./json/config.json'); |
||||
client.auth = require('./json/auth.json'); |
||||
client.config.randResp = require('./json/randresp.json'); |
||||
|
||||
require('./util/misc/setutils')(client); |
||||
require('./util/misc/embed')(client); |
||||
|
||||
const loggers = log(client); |
||||
Object.keys(loggers).forEach(logger => client[logger] = loggers[logger]); |
||||
|
||||
client.log(client.utils.gr(client.config.randResp.clistart), {color: "#78d9f8", source: client.config.bot.consoleName}, true, true); //senko's wakeup log
|
||||
|
||||
require('./bot/startup/run/getflags')(client); |
||||
|
||||
await require('./db/connect')(client); //connect to database
|
||||
await require('./bot/startup/run/collect')(client); //load in commands and events
|
||||
await require('./bot/startup/run/login')(client); //log in to discord
|
||||
|
||||
} |
||||
|
||||
testConnection().then(() => startBot().catch(e => errorhandler(client, e))); |
@ -0,0 +1,33 @@ |
||||
const Discord = require('discord.js'); |
||||
const fs = require('fs'); |
||||
const chalk = require('chalk'); |
||||
const ora = require('ora'); |
||||
|
||||
const {EmbedBuilder} = require("discord.js"); |
||||
|
||||
module.exports = { |
||||
name: "reload", |
||||
aliases: ['relog', 'rel', 'refresh'], |
||||
help: new EmbedBuilder() |
||||
.setTitle("Help -> System Reloading") |
||||
.setDescription("Reloads the system extensions by refreshing all command and event files into client without terminating the node process.") |
||||
.addFields( |
||||
[{name: "Syntax", value: "`reload [log]`. Adding 'log' will log to the console as though the bot were in startup."}, |
||||
{name: "Notice", value: "This command is only available to developers."}] |
||||
), |
||||
category: 'Developer', |
||||
info: "Refresh all client commands and events and clear most of the require cache.", |
||||
syntax: '`reload`', |
||||
async execute(client, message, args, cmd) { |
||||
if (!client.config.developers.has(message.author.id)) {return message.channel.send(`You must be a ${client.config.bot.name} developer in order to do this!`);} |
||||
|
||||
if (!args.length) { |
||||
let timer = new Date().getTime(); |
||||
let commands = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); |
||||
let dirSet = new Map(); |
||||
fs.readdirSync('./commands').filter(file => !file.includes('.')).forEach(dir => fs.readdirSync(`./commands/${dir}`).filter(file => file.endsWith('.js')).forEach(x => {commands.push(x); dirSet.set(x, dir)})); |
||||
client.warn(`${chalk.gray('Reload:')} ${chalk.white('All commands and events are being reloaded!')}\``); |
||||
client.log(`Developer ${message.author.username} initiated the system refresh`, {color: 'ff4fd0', source: "info"}, 0, 1); |
||||
} |
||||
} |
||||
}; |
@ -0,0 +1,17 @@ |
||||
module.exports = { |
||||
name: "info", |
||||
aliases: ["i"], |
||||
syntax: '`info`', |
||||
category: 'Misc', |
||||
info: "Provides information about Senko.", |
||||
help: null, |
||||
guildOnly: false, |
||||
async run(client, message, args, cmd) { |
||||
message.channel.send({embeds: [client.embeds.base() |
||||
.setTitle("Senko the Helpful Sserver Mascot!") |
||||
.setThumbnail(message.guild ? message.guild.iconURL({dynamic: true, size: 2048}) : client.user.avatarURL()) |
||||
.setDescription("My name is Senko! I was developed by Kitsuu to help the LHTranslation team do their work more efficiently. " + |
||||
"I notify TLs when new chapters of their current series have been released, and may eventually track chapter status more precisely for users to see.") |
||||
]}); |
||||
} |
||||
}; |
@ -0,0 +1,30 @@ |
||||
{ |
||||
"bot": { |
||||
"name": "Senko", |
||||
"consoleName": "SNKO", |
||||
"prefix": "+", |
||||
"devPrefix": "s!" |
||||
}, |
||||
"embed": { |
||||
"colors": { |
||||
"base": "faba28", |
||||
"success": "23d534", |
||||
"fail": "d52334" |
||||
} |
||||
}, |
||||
"log": { |
||||
"suffix": ">>", |
||||
"defaultLevel": 1, |
||||
"colors": { |
||||
"error": "redBright", |
||||
"warn": "yellowBright", |
||||
"success": "greenBright", |
||||
"notice": "#8521a0", |
||||
"primary": "blue", |
||||
"secondary": "green", |
||||
"altprimary": "blueBright", |
||||
"altsecondary": "greenBright" |
||||
} |
||||
}, |
||||
"developers": ["330547934951112705"] |
||||
} |
@ -0,0 +1,48 @@ |
||||
{ |
||||
"name": "Senko", |
||||
"version": "1.0.0", |
||||
"description": "", |
||||
"author": "WubzyGD", |
||||
"main": "index.js", |
||||
"engines": { |
||||
"node": ">=16.0.0" |
||||
}, |
||||
"scripts": { |
||||
"start": "node bot.js", |
||||
"start:pretty": "node bot.js -g -s", |
||||
"swin": "run", |
||||
"dev": "node bot.js -dev", |
||||
"dev:pretty": "node bot.js -dev -g -s", |
||||
"presync": "git pull origin", |
||||
"sync": "git push origin", |
||||
"postsync": "git push wubzy" |
||||
}, |
||||
"dependencies": { |
||||
"@discordjs/rest": "^2.4.3", |
||||
"axios": "^1.10.0", |
||||
"canvas": "^3.1.0", |
||||
"chalk": "^4.1.0", |
||||
"cheerio": "^1.1.0", |
||||
"discord-api-types": "^0.37.119", |
||||
"discord.js": "^14.18.0", |
||||
"dreidels": "^0.6.1", |
||||
"express": "^4.21.2", |
||||
"fuzzysort": "^3.1.0", |
||||
"google-auth-library": "^10.1.0", |
||||
"google-spreadsheet": "^4.1.5", |
||||
"googleapis": "^152.0.0", |
||||
"gradient-string": "^2.0.2", |
||||
"lastfm": "^0.9.4", |
||||
"moment": "^2.30.1", |
||||
"moment-precise-range-plugin": "^1.3.0", |
||||
"mongoose": "^8.10.0", |
||||
"node-fetch": "^3.3.2", |
||||
"ora": "^5.3.0", |
||||
"tinygradient": "^2.0.0", |
||||
"ws": "^8.18.0" |
||||
}, |
||||
"devDependencies": { |
||||
"typescript": "^5.7.3" |
||||
}, |
||||
"private": true |
||||
} |
@ -0,0 +1,32 @@ |
||||
const {EmbedBuilder} = require("discord.js"); |
||||
|
||||
const getFooterIcon = (client, message, options) => options |
||||
? options.footerIcon === "bot" |
||||
? client.user.avatarURL() |
||||
: options.footerIcon === "user" |
||||
? message.member |
||||
? message.member.displayAvatarURL({dynamic: true}) |
||||
: message.author.displayAvatarURL({dynamic: true}) |
||||
: options.footerIcon === "server" |
||||
? message.guild |
||||
? message.guild.iconURL({dynamic: true}) |
||||
: client.user.avatarURL() |
||||
: client.user.avatarURL() |
||||
: client.user.avatarURL(); |
||||
|
||||
module.exports = client => { |
||||
client.embeds = { |
||||
base: (message, options) => new EmbedBuilder() |
||||
.setColor(client.config.embed.colors.base) |
||||
.setFooter({text: client.config.bot.name, iconURL: getFooterIcon(client, message, options)}) |
||||
.setTimestamp(), |
||||
success: (message, options) => new EmbedBuilder() |
||||
.setColor(client.config.embed.colors.success) |
||||
.setFooter({text: client.config.bot.name, iconURL: getFooterIcon(client, message, options)}) |
||||
.setTimestamp(), |
||||
fail: (message, options) => new EmbedBuilder() |
||||
.setColor(client.config.embed.colors.fail) |
||||
.setFooter({text: client.config.bot.name, iconURL: getFooterIcon(client, message, options)}) |
||||
.setTimestamp() |
||||
} |
||||
}; |
Loading…
Reference in new issue