mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 16:30:58 -05:00
Compare commits
3 Commits
a75d1bdfa0
...
32dda719e4
Author | SHA1 | Date | |
---|---|---|---|
|
32dda719e4 | ||
|
8c3052fee3 | ||
|
815f4aa3bb |
15
.pnp.cjs
generated
15
.pnp.cjs
generated
@ -603,7 +603,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-continuation-local-storage-npm-3.2.7-763e4dc12b-1f272b53bc.zip/node_modules/@types/continuation-local-storage/",\
|
||||
"packageDependencies": [\
|
||||
["@types/continuation-local-storage", "npm:3.2.7"],\
|
||||
["@types/node", "npm:20.4.8"]\
|
||||
["@types/node", "npm:20.10.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@ -644,13 +644,6 @@ const RAW_RUNTIME_STATE =
|
||||
["undici-types", "npm:5.26.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["npm:20.4.8", {\
|
||||
"packageLocation": "./.yarn/cache/@types-node-npm-20.4.8-f8f2d8d349-199b047de6.zip/node_modules/@types/node/",\
|
||||
"packageDependencies": [\
|
||||
["@types/node", "npm:20.4.8"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/node-cron", [\
|
||||
@ -667,7 +660,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-pg-npm-8.10.9-ee8620c8e7-787be5431a.zip/node_modules/@types/pg/",\
|
||||
"packageDependencies": [\
|
||||
["@types/pg", "npm:8.10.9"],\
|
||||
["@types/node", "npm:20.4.8"],\
|
||||
["@types/node", "npm:20.10.5"],\
|
||||
["pg-protocol", "npm:1.6.0"],\
|
||||
["pg-types", "npm:4.0.1"]\
|
||||
],\
|
||||
@ -701,7 +694,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/@types-ws-npm-8.5.9-91d1b2ab07-7cf66383b8.zip/node_modules/@types/ws/",\
|
||||
"packageDependencies": [\
|
||||
["@types/ws", "npm:8.5.9"],\
|
||||
["@types/node", "npm:20.4.8"]\
|
||||
["@types/node", "npm:20.10.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@ -2732,7 +2725,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./.yarn/cache/wkx-npm-0.5.0-fca5152cd8-b8975e33f9.zip/node_modules/wkx/",\
|
||||
"packageDependencies": [\
|
||||
["wkx", "npm:0.5.0"],\
|
||||
["@types/node", "npm:20.4.8"]\
|
||||
["@types/node", "npm:20.10.5"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
|
@ -8,7 +8,7 @@
|
||||
"url": "git+https://github.com/AnxietyisReal/Daggerbot-TS.git"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "yarn tsc && yarn node . src/DB-Beta.config.json",
|
||||
"dev": "yarn tsc && yarn node . src/DB-Beta.config.json daggerbotbeta",
|
||||
"sdk": "yarn dlx @yarnpkg/sdks vscode"
|
||||
},
|
||||
"author": "Toast",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Discord from 'discord.js';
|
||||
import TClient from '../client.js';
|
||||
import Logger from '../helpers/Logger.js';
|
||||
import MessageTool from '../helpers/MessageTool.js';
|
||||
export default class InteractionCreate {
|
||||
static async run(client:TClient, interaction:Discord.BaseInteraction){
|
||||
if (!interaction.inGuild() || !interaction.inCachedGuild()) return;
|
||||
@ -30,14 +31,14 @@ export default class InteractionCreate {
|
||||
if (interaction.customId.startsWith('reaction-') && client.config.botSwitches.buttonRoles){
|
||||
const RoleID = interaction.customId.replace('reaction-','');
|
||||
|
||||
let roleConflictMsg = 'Cannot have both roles! - Button Role';
|
||||
const MFFarm1 = '1149139369433776269';
|
||||
const MFFarm2 = '1149139583729160325';
|
||||
if (interaction.member.roles.cache.has(MFFarm1) && RoleID === MFFarm2) interaction.member.roles.remove(MFFarm1, roleConflictMsg);
|
||||
else if (interaction.member.roles.cache.has(MFFarm2) && RoleID === MFFarm1) interaction.member.roles.remove(MFFarm2, roleConflictMsg);
|
||||
|
||||
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(()=>interaction.reply({content: `You have been added to <@&${RoleID}>`, ephemeral: true}));
|
||||
else interaction.member.roles.add(RoleID, 'Button Role').then(()=>{
|
||||
this.roleConflictHandler(interaction, MFFarm1, MFFarm2, RoleID);
|
||||
interaction.reply({content: `You have been added to <@&${RoleID}>`, ephemeral: true, fetchReply: true})
|
||||
});
|
||||
} else if (interaction.customId.includes('deleteEvalEmbed')) {
|
||||
if (!client.config.whitelist.includes(interaction.user.id)) return interaction.reply({content: 'You are not whitelisted, therefore you cannot delete this message.', ephemeral: true});
|
||||
interaction.message.delete();
|
||||
@ -45,4 +46,12 @@ export default class InteractionCreate {
|
||||
} else Logger.console('log', logPrefix, `Button has been pressed at ${interaction.message.url}`);
|
||||
}
|
||||
}
|
||||
static roleConflictHandler(interaction:Discord.ButtonInteraction<'cached'>, role1:Discord.Snowflake, role2:Discord.Snowflake, newRole:Discord.Snowflake) {
|
||||
if (interaction.member.roles.cache.has(role1) && interaction.member.roles.cache.has(role2)) {
|
||||
const roleToRemove = newRole === role1 ? role2 : role1;
|
||||
interaction.member.roles.remove(roleToRemove, 'Cannot have both roles! - Button Role').then(()=>interaction.editReply({
|
||||
content: `You cannot have both farm roles, so you have been removed from ${MessageTool.formatMention(roleToRemove, 'role')} and added to ${MessageTool.formatMention(newRole, 'role')}`}
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
import TokenService from '@toast/tokenservice-client';
|
||||
|
||||
export default async()=>new TokenService('daggerbot').connect();
|
||||
export default async()=>new TokenService(process.argv[3] ?? 'daggerbot').connect();
|
||||
|
@ -98,7 +98,7 @@ export class MPServerSvc {
|
||||
const findServerByName = await this.model.findOne({where: {serverName: serverName}});
|
||||
if (findServerByName) {
|
||||
let PD = findServerByName.dataValues.playerData;
|
||||
if (PD.length > 256) PD = [];
|
||||
if (PD.length > 1920) PD = []; //Selfnote: 86400/45 = 1920, where 86400 is seconds in a day and 45 is the MPModule's refresh interval.
|
||||
PD.push(playerCount);
|
||||
const updatePD = await this.model.update({playerData: PD}, {where: {serverName: serverName}});
|
||||
if (updatePD) true;
|
||||
|
@ -441,14 +441,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*":
|
||||
version: 20.4.8
|
||||
resolution: "@types/node@npm:20.4.8"
|
||||
checksum: 199b047de67708c36d4c432d46a6b9ef2cef4bfbf0c0e0b6831aee1a9c071e8430287a7cba18ea3c0b7d0332bc5e69e2bf71ba2da022769990e5551b90a65b18
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:20.10.5":
|
||||
"@types/node@npm:*, @types/node@npm:20.10.5":
|
||||
version: 20.10.5
|
||||
resolution: "@types/node@npm:20.10.5"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user