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

Compare commits

..

2 Commits

Author SHA1 Message Date
dependabot[bot]
1b65010271
Bump typescript from 5.4.5 to 5.5.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.5 to 5.5.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.5...v5.5.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-23 01:19:36 +00:00
toast-ts
556401bc12 Discord decided that the bot shouldn't view it 2024-07-23 11:15:13 +10:00
8 changed files with 25 additions and 30 deletions

View File

@ -1,7 +1,7 @@
services:
cache:
container_name: daggerbot-redis
image: redis/redis-stack-server:7.4.0-rc2
image: redis/redis-stack-server:7.2.0-v10
restart: unless-stopped
ports:
- 6379:6379/tcp

View File

@ -46,7 +46,7 @@
},
"devDependencies": {
"@types/ms": "0.7.34",
"@types/node": "20.14.12",
"@types/node": "20.14.11",
"@types/node-cron": "3.0.11",
"typescript": "5.5.4"
}

View File

@ -6,7 +6,7 @@ import CanvasBuilder from '../components/CanvasBuilder.js';
import RanIntoHumor from '../helpers/RanIntoHumor.js';
import MessageTool from '../helpers/MessageTool.js';
import {FSData} from 'src/interfaces';
import {requestServerData, mpModuleDisabled, refreshTimerSecs, playtimeStat, MPChannels} from '../modules/MPModule.js';
import {requestServerData, mpModuleDisabled, /* refreshTimerSecs, */ playtimeStat, MPChannels} from '../modules/MPModule.js';
async function fetchData(client:TClient, interaction:Discord.ChatInputCommandInteraction, serverName:string):Promise<FSData|Discord.InteractionResponse> {
try {
@ -31,7 +31,7 @@ export default class MP {
}
static async run(client:TClient, interaction:Discord.ChatInputCommandInteraction<'cached'>) {
if (client.config.botSwitches.mpSys === false) return interaction.reply({embeds: [mpModuleDisabled(client)]});
if (client.uptime < refreshTimerSecs) return interaction.reply('MPModule isn\'t initialized yet, please wait a moment and try again.');
// if (client.uptime < refreshTimerSecs) return interaction.reply('MPModule isn\'t initialized yet, please wait a moment and try again.');
if ([MPChannels.mainMpChat, client.config.dcServer.channels.multifarm_chat].includes(interaction.channelId) && !MessageTool.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply(`Please use <#${MPChannels.activePlayers}> for \`/mp status/players\` commands to prevent clutter in this channel.`).then(()=>setTimeout(()=>interaction.deleteReply(), 6000));
const choiceSelector = interaction.options.getString('server');
({

View File

@ -52,8 +52,8 @@ export default class InteractionCreate {
const timeDiff = time - isRatelimited;
if (timeDiff < 5000) return interaction.reply({content: 'You are on **__cooldown__**, please avoid spam-clicking next time.\n\n*This system is put in place due to selfbots.. I\'m sorry!*', ephemeral: true});
const MFFarm1 = '1266225167194001469';
const MFFarm2 = '1266225291232280707';
const MFFarm1 = '1149139369433776269';
const MFFarm2 = '1149139583729160325';
if (interaction.member.roles.cache.has(RoleID)) interaction.member.roles.remove(RoleID, 'Button Role').then(()=>interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true}));
else interaction.member.roles.add(RoleID, 'Button Role').then(async()=>{

View File

@ -86,7 +86,7 @@ export default class MessageCreate {
for (let i = 0; i < times_of_day.length; i++) Response.create(message, GeneralChatID, times_of_day[i]); */
CmdTrigger.registerCmds(client, message, 'deploy');
// CmdTrigger.MFPwTrigger(message, 'farmpw');
CmdTrigger.MFPwTrigger(message, 'farmpw');
let picStorage = {
cantRead: 'https://tenor.com/view/aristocats-george-pen-cap-meticulous-gif-5330931',

View File

@ -5,7 +5,7 @@ import {disabledChannels} from '../index.js';
export default class MessageDelete {
static run(client:TClient, msg:Discord.Message|Discord.PartialMessage){
if (!client.config.botSwitches.logs) return;
if (msg.guild?.id != client.config.dcServer.id || msg.partial || msg.type === Discord.MessageType.ChannelPinnedMessage || msg.author.bot || disabledChannels.includes(msg.channelId)) return;
if (msg.guild?.id != client.config.dcServer.id || msg.partial || msg.author.bot || disabledChannels.includes(msg.channelId)) return;
if (Discord.DiscordAPIError.name === '10008') return Logger.console('log', 'MsgDelete', 'Caught an unexpected error returned by Discord API. (Unknown Message)');
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.username} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted');
if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${Discord.escapeCodeBlock(msg.content.slice(0,1000))}\n\`\`\``});

View File

@ -75,17 +75,14 @@ setInterval(async()=>{
Logger.console('log', 'DailyMsgs', `Pushed [${formattedDate}, ${total}]`)
// Send notification to #bot-log that the data has been pushed to database.
try {
const commands = await client.guilds.cache.get(client.config.dcServer.id)?.commands.fetch();
if (commands) (client.channels.cache.get(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({embeds: [
new client.embed().setDescription(`Pushed the following\ndata to </rank leaderboard:${commands.find(x=>x.name === 'rank').id}>`).setFields(
{name: 'Day', value: formattedDate.toString(), inline: true},
{name: 'Messages', value: Intl.NumberFormat('en-us').format(total).toString(), inline: true}
).setColor(client.config.embedColor)
]});
} catch {
Logger.console('log', 'DailyMsgs', 'Rank command not found, cannot send notification in channel');
}
const commands = await client.guilds.cache.get(client.config.dcServer.id)?.commands.fetch();
if (commands) (client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({embeds: [
new client.embed().setDescription(`Pushed the following\ndata to </rank leaderboard:${commands.find(x=>x.name === 'rank').id}>`).setFields(
{name: 'Day', value: formattedDate.toString(), inline: true},
{name: 'Messages', value: Intl.NumberFormat('en-us').format(total).toString(), inline: true}
).setColor(client.config.embedColor)
]});
else Logger.console('log', 'DailyMsgs', 'Rank command not found, cannot send notification in channel')
}
}
}, 5000)
@ -107,20 +104,18 @@ if (!client.config.botSwitches.logs) {
};
client.on('raw', async (packet:RawGatewayPacket<RawMessageUpdate>)=>{
if (rawSwitches[packet.t] || packet.t !== 'MESSAGE_UPDATE') return;
if (packet.d.guild_id != client.config.dcServer.id || disabledChannels.includes(packet.d.channel_id) || typeof packet.d.content === undefined) return;
if (packet.d.guild_id != client.config.dcServer.id || disabledChannels.includes(packet.d.channel_id) || typeof packet.d.content === 'undefined') return;
const channel: Discord.TextBasedChannel = client.channels.cache.get(packet.d.channel_id) as Discord.TextChannel;
const channel = client.channels.cache.get(packet.d.channel_id) as Discord.TextBasedChannel;
// Switched to console.log to prevent useless embed creation that has same content as the original message.
if (!rawSwitches.MESSAGE_UPDATE && !packet.d.author.bot) return Logger.console('log', 'RawEvent:Edit', `Message was edited in #${channel.name}`);
if (!rawSwitches.MESSAGE_UPDATE && !packet.d.author.bot) return Logger.console('log', 'RawEvent:Edit', `Message was edited in #${(channel as Discord.TextChannel).name}`);
});
client.on('raw', async (packet:RawGatewayPacket<RawMessageDelete>)=>{
if (rawSwitches[packet.t]) return;
if (packet.t !== 'MESSAGE_DELETE' || packet.d.guild_id != client.config.dcServer.id || disabledChannels.includes(packet.d.channel_id)) return;
const channel: Discord.TextBasedChannel = client.channels.cache.get(packet.d.channel_id) as Discord.TextChannel;
Logger.console('log', 'RawEvent:Del', `Message was deleted in #${channel.name}`);
Logger.console('log', 'RawEvent:Del', `Message was deleted in #${(client.channels.resolve(packet.d.channel_id) as Discord.TextChannel).name}`);
rawSwitches[packet.t] = true;
});

View File

@ -531,12 +531,12 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:*, @types/node@npm:20.14.12":
version: 20.14.12
resolution: "@types/node@npm:20.14.12"
"@types/node@npm:*, @types/node@npm:20.14.11":
version: 20.14.11
resolution: "@types/node@npm:20.14.11"
dependencies:
undici-types: "npm:~5.26.4"
checksum: 10/9205bf46ef6a99d99cdde9efeb8218cd15803cc407249c2336557cd630b006380dad68c03ee574934414639f8e450044f45530c92788a8e82078bae45ee40f93
checksum: 10/344e1ce1ed16c86ed1c4209ab4d1de67db83dd6b694a6fabe295c47144dde2c58dabddae9f39a0a2bdd246e95f8d141ccfe848e464884b48b8918df4f7788025
languageName: node
linkType: hard
@ -663,7 +663,7 @@ __metadata:
"@sequelize/postgres": "npm:7.0.0-alpha.41"
"@toast/tokenservice-client": "npm:1.2.8"
"@types/ms": "npm:0.7.34"
"@types/node": "npm:20.14.12"
"@types/node": "npm:20.14.11"
"@types/node-cron": "npm:3.0.11"
ansi-colors: "npm:4.1.3"
dayjs: "npm:1.11.12"