1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 16:30:58 -05:00

Compare commits

...

4 Commits

Author SHA1 Message Date
AnxietyisReal
9b705a4219 Punishment improvements 2024-01-22 15:45:25 +11:00
AnxietyisReal
3ff70e9236 Filter out my IP from being added to reject list 2024-01-22 14:56:04 +11:00
AnxietyisReal
bf934f2f53 Spelling. 2024-01-22 13:52:52 +11:00
AnxietyisReal
e91fd4c6d0 Update systeminformation 2024-01-22 13:34:29 +11:00
9 changed files with 27 additions and 19 deletions

10
.pnp.cjs generated
View File

@ -46,7 +46,7 @@ const RAW_RUNTIME_STATE =
["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\
["systeminformation", "npm:5.21.23"],\
["systeminformation", "npm:5.21.24"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.4.0"]\
],\
@ -1011,7 +1011,7 @@ const RAW_RUNTIME_STATE =
["redis", "npm:4.6.12"],\
["sequelize", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:6.35.2"],\
["simple-git", "npm:3.22.0"],\
["systeminformation", "npm:5.21.23"],\
["systeminformation", "npm:5.21.24"],\
["typescript", "patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"],\
["undici", "npm:6.4.0"]\
],\
@ -2520,10 +2520,10 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["systeminformation", [\
["npm:5.21.23", {\
"packageLocation": "./.yarn/unplugged/systeminformation-npm-5.21.23-f0c4f32b3c/node_modules/systeminformation/",\
["npm:5.21.24", {\
"packageLocation": "./.yarn/unplugged/systeminformation-npm-5.21.24-211bacc546/node_modules/systeminformation/",\
"packageDependencies": [\
["systeminformation", "npm:5.21.23"]\
["systeminformation", "npm:5.21.24"]\
],\
"linkType": "HARD"\
}]\

View File

@ -47,7 +47,7 @@
"redis": "4.6.12",
"sequelize": "6.35.2",
"simple-git": "3.22.0",
"systeminformation": "5.21.23",
"systeminformation": "5.21.24",
"undici": "6.4.0"
},
"devDependencies": {

View File

@ -41,7 +41,7 @@ export default class Case {
{name: '\u200b', value: '\u200b', inline: true},
{name: 'Reason', value: `\`${punishment.reason || 'Reason unspecified'}\``, inline: true})
if (punishment.dataValues.duration) embed.addFields({name: 'Duration', value: `${Formatters.timeFormat(punishment.dataValues.duration, 100)}`})
if (punishment.dataValues.expired) embed.addFields({name: 'Expired', value: `This case has been overwritten by Case #${cancelledBy.dataValues.case_id} for reason \`${cancelledBy.dataValues.reason}\``})
if (punishment.dataValues.expired) embed.addFields({name: 'Expired', value: `This case has been overwritten by Case #${cancelledBy.dataValues.case_id} with reason \`${cancelledBy.dataValues.reason}\``})
if (punishment.dataValues.cancels) embed.addFields({name: 'Overwrites', value: `This case overwrites Case #${cancels.dataValues.case_id} with reason \`${cancels.dataValues.reason}\``})
interaction.reply({embeds: [embed]});
},

View File

@ -209,7 +209,7 @@ export default class Developer {
.setRequired(true)))
.addSubcommand(x=>x
.setName('modify_rank_msgs')
.setDescription('Modify the messages count of a member')
.setDescription('Modify the message count of a member')
.addUserOption(x=>x
.setName('member')
.setDescription('Member to modify the message count of')

View File

@ -11,8 +11,9 @@ export default class Unpunish {
const reason = interaction.options.getString('reason') ?? 'Reason unspecified';
await client.punishments.punishmentRemove(punishment.dataValues.case_id, interaction.user.id, reason, interaction);
Logger.console('log', 'UnpunishmentLog', `Case #${interaction.options.getInteger('case_id')} was used in /${interaction.commandName} for ${reason}`);
(client.channels.cache.get(client.config.dcServer.channels.punishment_log) as Discord.TextChannel).send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle('Unpunishment Log').setDescription(`Case #${interaction.options.getInteger('case_id')} was used in \`/${interaction.commandName}\` for \`${reason}\``).setTimestamp()]});
const unpunishLog = `Case #${interaction.options.getInteger('case_id')} was used in \`/${interaction.commandName}\` for \`${reason}\``;
Logger.console('log', 'UnpunishmentLog', unpunishLog);
(client.channels.cache.get(client.config.dcServer.channels.punishment_log) as Discord.TextChannel).send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle('Unpunishment Log').setDescription(unpunishLog).setTimestamp()]});
}
static data = new Discord.SlashCommandBuilder()
.setName('unpunish')

View File

@ -1,18 +1,24 @@
import Discord from 'discord.js';
import TClient from '../client.js';
import MessageTool from '../helpers/MessageTool.js';
import Logger from '../helpers/Logger.js';
export default async(client:TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>, type: 'ban'|'softban'|'kick'|'mute'|'warn'|'remind')=>{
if (!MessageTool.isModerator(interaction.member)) return MessageTool.youNeedRole(interaction, 'dcmod');
const isInBKL = ['ban', 'kick'].includes(type) && interaction.channelId === client.config.dcServer.channels.bankick_log;
const time = interaction.options.getString('time') ?? undefined;
const reason = interaction.options.getString('reason') ?? 'Reason unspecified';
const GuildMember = interaction.options.getMember('member') ?? undefined;
const User = interaction.options.getUser('member', true);
const punishLog = `${GuildMember?.user?.username ?? User?.username ?? 'No user data'} ${time ? ['warn', 'kick'].includes(type) ? 'and no duration set' : `and ${time} (duration)` : ''} was used in \`/${interaction.commandName}\` for \`${reason}\``;
Logger.console('log', 'PunishmentLog', punishLog);
(client.channels.cache.get(client.config.dcServer.channels.punishment_log) as Discord.TextChannel).send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle('Punishment Log').setDescription(punishLog).setTimestamp()]});
if (interaction.user.id === User.id) return interaction.reply(`You cannot ${type} yourself.`);
if (!GuildMember && !['unban', 'ban'].includes(type)) return interaction.reply(`You cannot ${type} someone who is not in the server.`);
if (User.bot) return interaction.reply(`You cannot ${type} a bot!`);
await interaction.deferReply();
await interaction.deferReply({ephemeral: isInBKL});
await client.punishments.punishmentAdd(type, {time, interaction}, interaction.user.id, reason, User, GuildMember);
}

View File

@ -129,7 +129,7 @@ export class PunishmentsSvc {
{name: '\u200b', value: '\u200b', inline: true},
{name: '🔹 Reason', value: `\`${punishment.reason}\``, inline: true}
).setTimestamp(punishment.time);
if (punishment.duration) embed.addFields({name: '🔹 Duration', value: `${Formatters.timeFormat(punishment.duration, 4, {longNames: false, commas: true})}`, inline: true}, {name: '\u200b', value: '\u200b', inline: true});
if (punishment.duration) embed.addFields({name: '🔹 Duration', value: `${Formatters.timeFormat(punishment.duration, 4, {longNames: true, commas: true})}`, inline: true}, {name: '\u200b', value: '\u200b', inline: true});
if (punishment.cancels) {
const cancels = await this.model.findOne({where: {case_id: punishment.cancels}})
embed.addFields({name: '🔹 Overwrites', value: `This case invalidates Case #${cancels.dataValues.case_id}\n\`${cancels.dataValues.reason}\``});
@ -252,7 +252,7 @@ export class PunishmentsSvc {
.setColor(this.client.config.embedColor)
.setTitle(`${removePunishmentData.type[0].toUpperCase() + removePunishmentData.type.slice(1)} | Case #${removePunishmentData.case_id}`)
.setDescription(`${user.username}\n<@${user.id}>\n\`${user.id}\``)
.addFields({name: 'Reason', value: reason}, {name: 'Overwrites', value: `Case #${punishment.case_id}`})
.addFields({name: 'Reason', value: `\`${reason}\``}, {name: 'Overwrites', value: `Case #${punishment.case_id}`})
]});
else return `Successfully un${this.getPastTense(removePunishmentData.type.replace('un', ''))} ${user.username} (\`${user.id}\`) for ${reason}`
}

View File

@ -17,8 +17,9 @@ new_ips=0
# Populate the UFW reject rule with the IP addresses collected from the kernel log
while IFS= read -r ip
do
ip_prefix="${ip%.*}"
# Check if the IP is already in the UFW rules
if ! ufw status | grep -q "$ip"
if ! ufw status | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ]
then
ufw reject from $ip
# Increment the counter

View File

@ -764,7 +764,7 @@ __metadata:
redis: "npm:4.6.12"
sequelize: "npm:6.35.2"
simple-git: "npm:3.22.0"
systeminformation: "npm:5.21.23"
systeminformation: "npm:5.21.24"
typescript: "npm:5.3.3"
undici: "npm:6.4.0"
languageName: unknown
@ -2065,12 +2065,12 @@ __metadata:
languageName: node
linkType: hard
"systeminformation@npm:5.21.23":
version: 5.21.23
resolution: "systeminformation@npm:5.21.23"
"systeminformation@npm:5.21.24":
version: 5.21.24
resolution: "systeminformation@npm:5.21.24"
bin:
systeminformation: lib/cli.js
checksum: b2084429c552e9600795c01620ed94c0289e3214bb0501b2d265b84c3682e2ad969fb3eb3914726d05be62dbd073138cfdb65a49b3bf335cebd15f5740be89c5
checksum: 3796b8474c25420f2fb7dc91b55e5f30050f9eaa01351ed6cfb56569d9789e19245985a9cd65e4b9adcdf13baa5148f2a722e1792d940e8e9ab32872226a53cd
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
languageName: node
linkType: hard