mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
Fix Credit Generation
This commit is contained in:
@@ -28,17 +28,29 @@ module.exports = class GenerateCreditCommand extends Command {
|
|||||||
for (const cred of command.credit) {
|
for (const cred of command.credit) {
|
||||||
const found = credit.find(c => c.name === cred.name);
|
const found = credit.find(c => c.name === cred.name);
|
||||||
if (found) {
|
if (found) {
|
||||||
found.commands.push(command.name);
|
found.commands.push({
|
||||||
|
name: command.name,
|
||||||
|
reason: cred.reason,
|
||||||
|
reasonURL: cred.reasonURL
|
||||||
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cred.name === 'Dragon Fire') continue;
|
if (cred.name === 'Dragon Fire') continue;
|
||||||
credit.push({ ...cred, commands: [command.name] });
|
credit.push({
|
||||||
|
name: cred.name,
|
||||||
|
url: cred.url,
|
||||||
|
commands: [{
|
||||||
|
name: command.name,
|
||||||
|
reason: cred.reason,
|
||||||
|
reasonURL: cred.reasonURL
|
||||||
|
}]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const mapped = credit
|
const mapped = credit
|
||||||
.map(c => `- [${c.name}](${c.url})\n${c.commands.map(cmd => {
|
.map(c => `- [${c.name}](${c.url})\n${c.commands.map(cmd => {
|
||||||
if (!c.reasonURL) return ` * ${cmd} (${c.reason})`;
|
if (!cmd.reasonURL) return ` * ${cmd.name} (${cmd.reason})`;
|
||||||
return ` * ${cmd} ([${c.reason}](${c.reasonURL}))`;
|
return ` * ${cmd.name} ([${cmd.reason}](${cmd.reasonURL}))`;
|
||||||
}).join('\n')}`);
|
}).join('\n')}`);
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post('https://hastebin.com/documents')
|
.post('https://hastebin.com/documents')
|
||||||
|
|||||||
Reference in New Issue
Block a user