mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-12-28 08:55:38 -05:00
Drop WClient from client.ts
This commit is contained in:
parent
c71fd93e0b
commit
5388b25869
@ -1,4 +1,4 @@
|
||||
import Discord, {Client, WebhookClient, GatewayIntentBits, Partials} from 'discord.js';
|
||||
import Discord, {Client, 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,11 +212,3 @@ 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;
|
||||
}
|
||||
}
|
||||
|
@ -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.webhook_url,
|
||||
client.tokens.webhook_url_test,client.tokens.mongodb_uri,client.tokens.mongodb_uri_dev,client.tokens.octokit
|
||||
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
|
||||
].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\`\`\``},
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Discord from 'discord.js';
|
||||
import TClient,{WClient} from '../client.js';
|
||||
import TClient 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 wclient = new WClient;
|
||||
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 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);
|
||||
wclient.send({embeds: [notifEmbed], username: `${client.user.username} Notification`, avatarURL: client.user.avatarURL({size: 256})}
|
||||
webhook.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})
|
||||
|
@ -81,6 +81,7 @@
|
||||
"console": "1011318687065710663",
|
||||
"errors": "1009754872188506192",
|
||||
"thismeanswar": "1091300529696673792",
|
||||
"bot_suggestions": "1040018521746325586",
|
||||
"bot_status": "1009753780188884992",
|
||||
"logs": "548032776830582794",
|
||||
"welcome": "621134751897616406",
|
||||
|
3
src/typings/interfaces.d.ts
vendored
3
src/typings/interfaces.d.ts
vendored
@ -121,8 +121,6 @@ export interface Tokens {
|
||||
secret: string
|
||||
}
|
||||
octokit: string
|
||||
webhook_url: string
|
||||
webhook_url_test: string
|
||||
mongodb_uri: string
|
||||
mongodb_uri_dev: string
|
||||
}
|
||||
@ -181,6 +179,7 @@ export interface Config {
|
||||
console: string,
|
||||
errors: string,
|
||||
thismeanswar: string,
|
||||
bot_suggestions: string,
|
||||
bot_status: string,
|
||||
logs: string,
|
||||
welcome: string,
|
||||
|
Loading…
Reference in New Issue
Block a user