mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 12:21:00 -05:00
Compare commits
4 Commits
e9906853bd
...
7c40fdb83a
Author | SHA1 | Date | |
---|---|---|---|
|
7c40fdb83a | ||
|
c9ae5226e9 | ||
|
76a1cc52e9 | ||
|
4a6b89e634 |
@ -7,7 +7,7 @@ services:
|
||||
- 6379:6379/tcp
|
||||
db:
|
||||
container_name: daggerbot-postgres
|
||||
image: postgres:16.2-alpine3.19
|
||||
image: postgres:16.3-alpine3.19
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 5432:5432/tcp
|
||||
|
@ -41,12 +41,12 @@
|
||||
"node-cron": "3.0.3",
|
||||
"redis": "4.6.13",
|
||||
"simple-git": "3.24.0",
|
||||
"systeminformation": "5.22.8",
|
||||
"systeminformation": "5.22.9",
|
||||
"undici": "6.16.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ms": "0.7.34",
|
||||
"@types/node": "20.12.11",
|
||||
"@types/node": "20.12.12",
|
||||
"@types/node-cron": "3.0.11",
|
||||
"typescript": "5.4.5"
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ export default class FAQ {
|
||||
static run(_client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
({
|
||||
srp: ()=>FAQHelper.reply(interaction, null, `[Ballyspring](<${FAQHelper.linkMapping.ballyspring}>) is the map that is used in Survival Roleplay S4.\n\n> ℹ️ __Note__\n> The map won't look closely like the one in SRP as it is privately edited version of the public map.`, null, false),
|
||||
vtcR: ()=>interaction.reply(FAQHelper.youCanGetRole('vtcmember', 'truck')+'\n*VTC skin can also be found in <#801975222609641472> as well.*'),
|
||||
vtcR: ()=>interaction.reply(FAQHelper.youCanGetRole('vtcmember', 'truck')+`\n*VTC skin can also be found in the [VTC announcements channel](<${FAQHelper.linkMapping.vtcPaintjob}>).*`),
|
||||
mpR: ()=>interaction.reply(FAQHelper.youCanGetRole('mpplayer', 'tractor')),
|
||||
ytscam: ()=>FAQHelper.reply(interaction, 'Scammers in YouTube comments section', 'If you ever see a comment mentioning a giveaway or anything else, **it\'s a scam!**\nYou should report it to YouTube and move on or ignore it.\nP.S: They\'re on every channel and not just Daggerwin.', FAQHelper.CDN('YTScam'), true),
|
||||
steamscam: ()=>FAQHelper.reply(interaction, 'Steam account report scam', `If you received a DM about this, please report it to Discord Moderators or open a [ticket](${FAQHelper.linkMapping.staffTicket})`, FAQHelper.CDN('SteamScam'), true),
|
||||
steamscam: ()=>FAQHelper.reply(interaction, 'Steam account report scam', `If you received a DM about this, please report it to Discord Moderators or open a [ticket](${FAQHelper.linkMapping.discordModTicket})`, FAQHelper.CDN('SteamScam'), true),
|
||||
fsVerifyGame: ()=>FAQHelper.reply(interaction, 'Verifying your game files', `You can verify your game files if you experience any issues with your game.\n${FAQHelper.verifyGameFiles}`, FAQHelper.CDN('Steam-Epic-VerifyGamesLocation'), true),
|
||||
fsShader: ()=>FAQHelper.reply(interaction, 'Clearing your shader cache folder', 'If your game keeps crashing shortly after opening your game, then the shaders might be an issue.\nTo resolve this, you can go to `Documents/My Games/FarmingSimulator2022` and delete the folder called `shader_cache`', FAQHelper.CDN('shader_cache-Location'), true),
|
||||
fsLogfile: ()=>FAQHelper.reply(interaction, 'Uploading your log file', 'You can find `log.txt` in `Documents/My Games/FarmingSimulator2022` and upload it into <#596989522395398144> along with your issue, so people can assist you further and help you resolve.', FAQHelper.CDN('log_txt-Location'), true),
|
||||
|
@ -5,7 +5,6 @@ import Logger from '../helpers/Logger.js';
|
||||
import CanvasBuilder from '../components/CanvasBuilder.js';
|
||||
import RanIntoHumor from '../helpers/RanIntoHumor.js';
|
||||
import MessageTool from '../helpers/MessageTool.js';
|
||||
import PalletLibrary from '../helpers/PalletLibrary.js';
|
||||
import {FSData} from 'src/interfaces';
|
||||
import {requestServerData, mpModuleDisabled, refreshTimerSecs, playtimeStat, MPChannels} from '../modules/MPModule.js';
|
||||
|
||||
@ -23,6 +22,7 @@ async function fetchData(client:TClient, interaction:Discord.ChatInputCommandInt
|
||||
|
||||
const logPrefix = 'MPDB';
|
||||
const MAP_POOL_HOOKMSG = '1141293129673232435';
|
||||
const PALLET_FILTER = ['PALLETS', 'BIGBAGPALLETS'];
|
||||
|
||||
export default class MP {
|
||||
static async autocomplete(client:TClient, interaction:Discord.AutocompleteInteraction<'cached'>) {
|
||||
@ -103,7 +103,7 @@ export default class MP {
|
||||
pallets: async()=>{
|
||||
const DSS = await fetchData(client, interaction, choiceSelector) as FSData;
|
||||
if (!DSS) return console.log('Endpoint failed - pallets');
|
||||
const filter = DSS?.vehicles.filter(x=>['PALLETS', 'BIGBAGPALLETS'].includes(x.category));
|
||||
const filter = DSS?.vehicles.filter(x=>PALLET_FILTER.includes(x.category));
|
||||
const rules = {
|
||||
one: 'single pallet',
|
||||
two: 'pallets',
|
||||
@ -112,10 +112,10 @@ export default class MP {
|
||||
}[new Intl.PluralRules('en', {type: 'ordinal'}).select(filter.length)];
|
||||
if (filter.length < 1) return interaction.editReply('No pallets found on the server.');
|
||||
else {
|
||||
const getLongestName = Object.entries(PalletLibrary(DSS)).map(([name, _])=>name.length).sort((a,b)=>b-a)[0];
|
||||
const getLongestName = Object.entries(this.getPalletCounts(DSS)).map(([name, _])=>name.length).sort((a,b)=>b-a)[0];
|
||||
await interaction.editReply(MessageTool.concatMessage(
|
||||
`There are currently **${filter.length}** ${rules} on the server. Here\'s the breakdown:\`\`\`ansi`,
|
||||
Object.entries(PalletLibrary(DSS)).map(([name, count])=>`${ansi.blue(name.padEnd(getLongestName+3))}${ansi.yellow(count.toString())}`).join('\n'),
|
||||
Object.entries(this.getPalletCounts(DSS)).map(([name, count])=>`${ansi.blue(name.padEnd(getLongestName+3))}${ansi.yellow(count.toString())}`).join('\n'),
|
||||
'```'
|
||||
))
|
||||
}
|
||||
@ -230,6 +230,14 @@ export default class MP {
|
||||
const numbersArr = ['1️⃣','2️⃣','3️⃣','4️⃣','5️⃣','6️⃣','7️⃣','8️⃣','9️⃣','🔟'];
|
||||
await Promise.all(numbersArr.slice(0, length).map(emote=>message.react(emote)));
|
||||
}
|
||||
private static getPalletCounts(data:FSData) {
|
||||
const pallets = data.vehicles.filter(x=>PALLET_FILTER.includes(x.category));
|
||||
const counts = pallets.reduce((acc, name)=>{
|
||||
acc[name.name] = (acc[name.name] ?? 0) + 1;
|
||||
return acc;
|
||||
}, {} as {[key:string]:number});
|
||||
return counts;
|
||||
}
|
||||
static data = new Discord.SlashCommandBuilder()
|
||||
.setName('mp')
|
||||
.setDescription('Get information from the FSMP server(s)')
|
||||
|
@ -10,7 +10,7 @@ export default class FAQHelper {
|
||||
else return interaction.reply(message).catch(err=>interaction.reply(this.errorMsg+'\n'+err))
|
||||
}
|
||||
public static CDN=(filename:string)=>'https://cdn.toast-server.net/daggerwin/'+filename+'.png';
|
||||
public static youCanGetRole=(role:string, roleEmoji:string)=>`You can get the ${MessageTool.formatMention(config.dcServer.roles[role], 'role')} role from <#802283932430106624> by clicking :${roleEmoji}: button on a webhook's message.`;
|
||||
public static youCanGetRole=(role:string, roleEmoji:string)=>`You can get the ${MessageTool.formatMention(config.dcServer.roles[role], 'role')} role from <#802283932430106624> by clicking :${roleEmoji}: on a webhook's message.`;
|
||||
public static readonly verifyGameFiles = this.ansiCodeblock(
|
||||
'[34m[1mSteam[0m (Top panel)',
|
||||
'1. Go to your game library and right click on Farming Simulator 22',
|
||||
@ -25,6 +25,7 @@ export default class FAQHelper {
|
||||
)
|
||||
public static readonly linkMapping = {
|
||||
ballyspring: 'https://www.farming-simulator.com/mod.php?mod_id=270745',
|
||||
staffTicket: 'https://discord.com/channels/468835415093411861/942173932339986472/1054129985788596385',
|
||||
discordModTicket: 'https://discord.com/channels/468835415093411861/942173932339986472/1054129985788596385',
|
||||
vtcPaintjob: 'https://discord.com/channels/468835415093411861/801975222609641472/1165673285460164739'
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
import {FSData} from 'src/interfaces';
|
||||
|
||||
export default function(data:FSData) {
|
||||
const pallets = data.vehicles.filter(x=>['PALLETS', 'BIGBAGPALLETS'].includes(x.category));
|
||||
const counts = pallets.reduce((acc, name)=>{
|
||||
acc[name.name] = (acc[name.name] ?? 0) + 1;
|
||||
return acc;
|
||||
}, {} as {[key:string]:number});
|
||||
return counts;
|
||||
}
|
20
yarn.lock
20
yarn.lock
@ -533,12 +533,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*, @types/node@npm:20.12.11":
|
||||
version: 20.12.11
|
||||
resolution: "@types/node@npm:20.12.11"
|
||||
"@types/node@npm:*, @types/node@npm:20.12.12":
|
||||
version: 20.12.12
|
||||
resolution: "@types/node@npm:20.12.12"
|
||||
dependencies:
|
||||
undici-types: "npm:~5.26.4"
|
||||
checksum: 10/c6afe7c2c4504a4f488814d7b306ebad16bf42cbb43bf9db9fe1aed8c5fb99235593c3be5088979a64526b106cf022256688e2f002811be8273d87dc2e0d484f
|
||||
checksum: 10/e3945da0a3017bdc1f88f15bdfb823f526b2a717bd58d4640082d6eb0bd2794b5c99bfb914b9e9324ec116dce36066990353ed1c777e8a7b0641f772575793c4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -665,7 +665,7 @@ __metadata:
|
||||
"@sequelize/postgres": "npm:7.0.0-alpha.40"
|
||||
"@toast/tokenservice-client": "npm:1.2.8"
|
||||
"@types/ms": "npm:0.7.34"
|
||||
"@types/node": "npm:20.12.11"
|
||||
"@types/node": "npm:20.12.12"
|
||||
"@types/node-cron": "npm:3.0.11"
|
||||
ansi-colors: "npm:4.1.3"
|
||||
dayjs: "npm:1.11.11"
|
||||
@ -676,7 +676,7 @@ __metadata:
|
||||
node-cron: "npm:3.0.3"
|
||||
redis: "npm:4.6.13"
|
||||
simple-git: "npm:3.24.0"
|
||||
systeminformation: "npm:5.22.8"
|
||||
systeminformation: "npm:5.22.9"
|
||||
typescript: "npm:5.4.5"
|
||||
undici: "npm:6.16.1"
|
||||
languageName: unknown
|
||||
@ -1262,12 +1262,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"systeminformation@npm:5.22.8":
|
||||
version: 5.22.8
|
||||
resolution: "systeminformation@npm:5.22.8"
|
||||
"systeminformation@npm:5.22.9":
|
||||
version: 5.22.9
|
||||
resolution: "systeminformation@npm:5.22.9"
|
||||
bin:
|
||||
systeminformation: lib/cli.js
|
||||
checksum: 10/d24d63015913d3358f6690f5881c7f3140397a3ffca0e05b41e94e8da6d5233046064ac0853f32272ca6ac246eeb51d5f9b8617cbd7c342f8cca1489e3fe7b60
|
||||
checksum: 10/c2006c817a362f309f058a4a1765e857d7986daa60260fe8f9574a3587a37c9b31aa3c5977a37f5a22b90acefc254eecf3e47ac4bd629072b4576fa171e13eac
|
||||
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
Loading…
Reference in New Issue
Block a user