Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
singleQuote
Browse files Browse the repository at this point in the history
  • Loading branch information
ringo360 committed Mar 2, 2024
1 parent 5548457 commit 715c146
Show file tree
Hide file tree
Showing 32 changed files with 319 additions and 310 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"useTabs": true
"useTabs": true,
"singleQuote": true
}
22 changes: 11 additions & 11 deletions commands/checkping.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { SlashCommandBuilder } = require("discord.js");
const { LANG, strFormat } = require("../util/languages");
const { SlashCommandBuilder } = require('discord.js');
const { LANG, strFormat } = require('../util/languages');
const {
CheckHostRequest,
CHECK_PING,
CheckPingOk,
isValidHostname,
} = require("../util/check-host");
const { formatTable } = require("../util/strings");
} = require('../util/check-host');
const { formatTable } = require('../util/strings');

module.exports = {
data: new SlashCommandBuilder()
Expand All @@ -30,7 +30,7 @@ module.exports = {
const msg = await interaction.reply(LANG.common.message.checking);
const resultMap = await request.checkResult(1.0, 7);
const table = [...resultMap.entries()].map(([node, result]) => {
const nodeName = node.name.replace(".node.check-host.net", "");
const nodeName = node.name.replace('.node.check-host.net', '');
const prefix = `[${nodeName}]`;
console.log(strFormat(LANG.common.message.dataFor, [nodeName]), result);
if (result instanceof CheckPingOk) {
Expand All @@ -39,26 +39,26 @@ module.exports = {
values.reduce((a, { ping: b }) => a + b, 0) / values.length;
return [
prefix,
values[3].reply + ",",
values[3].reply + ',',
values[3].ping,
"/",
values[2].reply + ",",
'/',
values[2].reply + ',',
values[2].ping,
"| Ping:",
'| Ping:',
`${Math.floor(average * 1000)} ms`,
];
}
return [prefix, result.state];
});
const str = formatTable(table, {
align: ["left", "left", "left", "left", "left", "left", "left", "right"],
align: ['left', 'left', 'left', 'left', 'left', 'left', 'left', 'right'],
});
msg.edit({
content: LANG.common.message.result,
files: [
{
attachment: Buffer.from(str),
name: "result.txt",
name: 'result.txt',
},
],
});
Expand Down
20 changes: 10 additions & 10 deletions commands/checktcp.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const { SlashCommandBuilder } = require("discord.js");
const { LANG, strFormat } = require("../util/languages");
const { SlashCommandBuilder } = require('discord.js');
const { LANG, strFormat } = require('../util/languages');
const {
CheckHostRequest,
CHECK_TCP,
CheckTcpOk,
CheckTcpError,
isValidHostname,
} = require("../util/check-host");
const { formatTable } = require("../util/strings");
} = require('../util/check-host');
const { formatTable } = require('../util/strings');
module.exports = {
data: new SlashCommandBuilder()
.setName(LANG.commands.checktcp.name)
Expand All @@ -29,32 +29,32 @@ module.exports = {
const msg = await interaction.reply(LANG.common.message.checking);
const resultMap = await request.checkResult(1.0, 7);
const table = [...resultMap.entries()].map(([node, result]) => {
const nodeName = node.name.replace(".node.check-host.net", "");
const nodeName = node.name.replace('.node.check-host.net', '');
const prefix = `[${nodeName}]`;
console.log(strFormat(LANG.common.message.dataFor, [nodeName]), result);
if (result instanceof CheckTcpOk) {
return [
prefix,
"OK,",
'OK,',
result.time,
"| Ping: ",
'| Ping: ',
`${Math.floor(result.time * 1000)} ms`,
];
}
if (result instanceof CheckTcpError) {
return [prefix, "ERROR", result.description];
return [prefix, 'ERROR', result.description];
}
return [prefix, result.state];
});
const str = formatTable(table, {
align: ["left", "left", "left", "left", "right"],
align: ['left', 'left', 'left', 'left', 'right'],
});
msg.edit({
content: LANG.common.message.result,
files: [
{
attachment: Buffer.from(str),
name: "result.txt",
name: 'result.txt',
},
],
});
Expand Down
10 changes: 5 additions & 5 deletions commands/discordinfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder, ChannelType } = require("discord.js");
const { LANG, strFormat } = require("../util/languages");
const { SlashCommandBuilder, ChannelType } = require('discord.js');
const { LANG, strFormat } = require('../util/languages');

module.exports = {
data: new SlashCommandBuilder()
Expand Down Expand Up @@ -42,7 +42,7 @@ module.exports = {
const roles = member.roles.cache
.filter((role) => role.id !== interaction.guild.roles.everyone.id)
.map((role) => role.name)
.join(", ");
.join(', ');

const roleCount = member.roles.cache.filter(
(role) => role.id !== interaction.guild.roles.everyone.id,
Expand Down Expand Up @@ -107,7 +107,7 @@ module.exports = {
const createdAt = `<t:${Math.floor(guild.createdTimestamp / 1000)}:R>`;
let guildIcon = guild.iconURL({ dynamic: true });
if (!guildIcon) {
guildIcon = "https://cdn.mcsv.life/boticon.webp";
guildIcon = 'https://cdn.mcsv.life/boticon.webp';
}

await interaction.reply({
Expand Down Expand Up @@ -140,7 +140,7 @@ module.exports = {
.textChannelCount,
[gchannels],
) +
"\n" +
'\n' +
strFormat(
LANG.commands.discordinfo.subcommands.server
.voiceChannelCount,
Expand Down
4 changes: 2 additions & 2 deletions commands/dm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("discord.js");
const { LANG, strFormat } = require("../util/languages");
const { SlashCommandBuilder } = require('discord.js');
const { LANG, strFormat } = require('../util/languages');
const cooldowns = new Map();

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions commands/fake.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { SlashCommandBuilder } = require("discord.js");
const { LANG, strFormat } = require("../util/languages");
const { SlashCommandBuilder } = require('discord.js');
const { LANG, strFormat } = require('../util/languages');
const rickurl =
"https://paste-pgpj.onrender.com/?p=%3Ciframe%20width=%221280%22%20height=%22720%22%20src=%22https://www.youtube.com/embed/dQw4w9WgXcQ%22%20title=%22Rick%20Astley%20-%20Never%20Gonna%20Give%20You%20Up%20(Official%20Music%20Video)%22%20frameborder=%220%22%20allow=%22accelerometer;%20autoplay;%20clipboard-write;%20encrypted-media;%20gyroscope;%20picture-in-picture;%20web-share%22%20allowfullscreen%3E%3C/iframe%3E";
'https://paste-pgpj.onrender.com/?p=%3Ciframe%20width=%221280%22%20height=%22720%22%20src=%22https://www.youtube.com/embed/dQw4w9WgXcQ%22%20title=%22Rick%20Astley%20-%20Never%20Gonna%20Give%20You%20Up%20(Official%20Music%20Video)%22%20frameborder=%220%22%20allow=%22accelerometer;%20autoplay;%20clipboard-write;%20encrypted-media;%20gyroscope;%20picture-in-picture;%20web-share%22%20allowfullscreen%3E%3C/iframe%3E';

module.exports = [
{
Expand Down
42 changes: 25 additions & 17 deletions commands/globalban.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const mongodb = require("../internal/mongodb"); //*MongoDB
const { AdminUserIDs } = require("../config.json");
const Pager = require("../util/pager");
const { LANG, strFormat } = require("../util/languages");
const {
SlashCommandBuilder,
PermissionsBitField,
ModalBuilder,
} = require('discord.js');
const mongodb = require('../internal/mongodb'); //*MongoDB
const { AdminUserIDs } = require('../config.json');
const Pager = require('../util/pager');
const { LANG, strFormat } = require('../util/languages');

module.exports = {
data: new SlashCommandBuilder()
Expand Down Expand Up @@ -76,7 +80,7 @@ module.exports = {
}
try {
// データベースから全てのユーザーを取得
const userCollection = mongodb.connection.collection("globalBans");
const userCollection = mongodb.connection.collection('globalBans');
const allUsers = await userCollection.find({}).toArray();

// ユーザー情報をログに表示
Expand Down Expand Up @@ -128,7 +132,7 @@ module.exports = {
} catch (error) {
console.error(error);
await interaction.editReply(
LANG.commands.globalban.generalError + "\n```" + error + "\n```",
LANG.commands.globalban.generalError + '\n```' + error + '\n```',
);
return;
}
Expand Down Expand Up @@ -156,7 +160,7 @@ module.exports = {
if (subcommand === LANG.commands.globalban.subcommands.add.name) {
try {
const existingBan = await mongodb.connection
.collection("globalBans")
.collection('globalBans')
.findOne({ userId: user.id });
if (existingBan) {
return await interaction.editReply(
Expand All @@ -165,7 +169,7 @@ module.exports = {
]),
);
}
await mongodb.connection.collection("globalBans").insertOne({
await mongodb.connection.collection('globalBans').insertOne({
userId: user.id,
userName: user.tag,
reason: reason,
Expand Down Expand Up @@ -195,7 +199,7 @@ module.exports = {
strFormat(LANG.commands.globalban.operationFailed, {
guildName: g.name,
}) +
"\n" +
'\n' +
e,
); // エラーが出たとき
}
Expand All @@ -213,14 +217,14 @@ module.exports = {
} catch (error) {
console.error(error);
await interaction.editReply(
LANG.commands.globalban.generalError + "\n```" + error + "\n```",
LANG.commands.globalban.generalError + '\n```' + error + '\n```',
);
return;
}
} else if (subcommand === LANG.commands.globalban.subcommands.remove.name) {
try {
const existingBan = await mongodb.connection
.collection("globalBans")
.collection('globalBans')
.findOne({ userId: user.id });
if (!existingBan) {
return await interaction.editReply(
Expand All @@ -231,7 +235,7 @@ module.exports = {
}

await mongodb.connection
.collection("globalBans")
.collection('globalBans')
.deleteOne({ userId: user.id });
let done = 0;
let fail = 0;
Expand Down Expand Up @@ -275,26 +279,26 @@ module.exports = {
} catch (error) {
console.error(error);
await interaction.editReply(
LANG.commands.globalban.generalError + "\n```" + error + "\n```",
LANG.commands.globalban.generalError + '\n```' + error + '\n```',
);
return;
}

//*LIST
} else if (subcommand === LANG.commands.globalban.subcommands.list.name) {
try {
const userCollection = mongodb.connection.collection("globalBans");
const userCollection = mongodb.connection.collection('globalBans');
const bans = await userCollection.find({}).toArray();
const pager = new Pager(
bans.map((ban) =>
strFormat(LANG.commands.globalban.subcommands.list.record, {
user:
"**" +
'**' +
strFormat(LANG.commands.globalban.subcommands.list.recordUser, {
name: ban.userName,
id: ban.userId,
}) +
"**",
'**',
reason: ban.reason || LANG.commands.globalban.noReason,
}),
),
Expand Down Expand Up @@ -350,6 +354,10 @@ module.exports = {
],
});
}
} else if (subcommand === 'report') {
const modal = new ModalBuilder()
.setCustomId('gbanReportMenu')
.setTitle('');
} else {
return await interaction.editReply(
LANG.commands.globalban.unsupportedSubcommandError,
Expand Down
Loading

0 comments on commit 715c146

Please sign in to comment.