1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 04:10:59 -05:00

Compare commits

..

No commits in common. "90fd9e62abcdf8dae918bf8a4af6060cea0f0361" and "33a37aa6e171445386c7c7ec411f39f721ac5c66" have entirely different histories.

9 changed files with 21 additions and 13 deletions

2
.pnp.loader.mjs generated
View File

@ -1471,7 +1471,7 @@ async function load$1(urlString, context, nextLoad) {
}
return {
format,
source: format === `commonjs` ? void 0 : await fs.promises.readFile(filePath, `utf8`),
source: await fs.promises.readFile(filePath, `utf8`),
shortCircuit: true
};
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
yarnPath: .yarn/releases/yarn-3.6.3.cjs
yarnPath: .yarn/releases/yarn-3.6.2.cjs

View File

@ -25,7 +25,7 @@
"node": ">=18.17.0",
"yarn": ">=3.6.1"
},
"packageManager": "yarn@3.6.3",
"packageManager": "yarn@3.6.2",
"dependencies": {
"@discord-player/extractor": "4.4.1",
"@discordjs/opus": "0.9.0",

View File

@ -1,4 +1,4 @@
import Discord, {Client, GatewayIntentBits, Partials} from 'discord.js';
import Discord, {Client, WebhookClient, GatewayIntentBits, Partials} from 'discord.js';
import {readFileSync, readdirSync} from 'node:fs';
import {formatTimeOpt, Tokens, Config, repeatedMessages, type MPServerCache} from './typings/interfaces';
import bannedWords from './models/bannedWords.js';
@ -212,3 +212,11 @@ export default class TClient extends Client {
} return array.join(dirSlash);
}
}
export class WClient extends WebhookClient {
tokens: Tokens;
constructor(){
super({url: tokens.webhook_url})
this.tokens = tokens as Tokens;
}
}

View File

@ -34,8 +34,8 @@ export default {
if (typeof output === 'object') output = 'js\n'+util.formatWithOptions({depth: 1}, '%O', output)
else output = '\n' + String(output);
[
client.tokens.main,client.tokens.beta,client.tokens.toast,client.tokens.dontlookatme.client,client.tokens.dontlookatme.secret,
client.tokens.mongodb_uri,client.tokens.mongodb_uri_dev,client.tokens.octokit
client.tokens.main,client.tokens.beta,client.tokens.toast,client.tokens.webhook_url,
client.tokens.webhook_url_test,client.tokens.mongodb_uri,client.tokens.mongodb_uri_dev,client.tokens.octokit
].forEach(x=>output = output.replace(new RegExp(x as string,'g'),':noblank: No token?'));
const embed = new client.embed().setColor(client.config.embedColor).setTitle('__Eval__').addFields(
{name: 'Input', value: `\`\`\`js\n${code.slice(0,1010)}\n\`\`\``},

View File

@ -1,5 +1,5 @@
import Discord from 'discord.js';
import TClient from '../client.js';
import TClient,{WClient} from '../client.js';
export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
const replyInDM = interaction.options.getString('message');
@ -12,7 +12,7 @@ export default {
const dmFail = `Failed to send a DM to <@${userid}>, they possibly have it turned off or blocked me.\nSuggestion ID: **${suggestionIDReply}**`;
({
your: async()=>{
const webhook = await (await (client.channels.fetch(client.config.mainServer.channels.bot_suggestions) as Promise<Discord.TextChannel>)).fetchWebhooks().then(x => x.find(y => y.name === client.user.username));
const wclient = new WClient;
const suggestionText = interaction.options.getString('suggestion');
const suggestionImage = interaction.options.getAttachment('image');
const notifEmbed = new client.embed()
@ -25,7 +25,7 @@ export default {
suggestionText
].join('\n'));
if (suggestionImage) notifEmbed.setImage(suggestionImage.url);
webhook.send({embeds: [notifEmbed], username: `${client.user.username} Notification`, avatarURL: client.user.avatarURL({size: 256})}
wclient.send({embeds: [notifEmbed], username: `${client.user.username} Notification`, avatarURL: client.user.avatarURL({size: 256})}
).catch(e=>{
console.log(e.message);
interaction.reply({content: 'Failed to send suggestion, try again later.', ephemeral: true})

View File

@ -81,7 +81,6 @@
"console": "1011318687065710663",
"errors": "1009754872188506192",
"thismeanswar": "1091300529696673792",
"bot_suggestions": "1040018521746325586",
"bot_status": "1009753780188884992",
"logs": "548032776830582794",
"welcome": "621134751897616406",

View File

@ -121,6 +121,8 @@ export interface Tokens {
secret: string
}
octokit: string
webhook_url: string
webhook_url_test: string
mongodb_uri: string
mongodb_uri_dev: string
}
@ -179,7 +181,6 @@ export interface Config {
console: string,
errors: string,
thismeanswar: string,
bot_suggestions: string,
bot_status: string,
logs: string,
welcome: string,