Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -74,7 +74,8 @@ const commandsData = [
|
|
| 74 |
{ name: 'profileimage', description: 'Generate a high-quality visual profile card', options: [{ name: 'user', type: 6, description: 'The user to check', required: false }] },
|
| 75 |
{ name: 'giverole', description: 'Give a role to members (Admin)', options: [{ name: 'role', type: 8, description: 'The role', required: true }] },
|
| 76 |
{ name: 'uptime', description: 'Show how long the bot has been online' },
|
| 77 |
-
{ name: 'motm', description: 'Award Man of the Match to a player', options: [{ name: 'player', type: 6, description: 'The player to award', required: true }] }
|
|
|
|
| 78 |
];
|
| 79 |
|
| 80 |
client.once('ready', async () => {
|
|
@@ -190,7 +191,7 @@ client.on('messageCreate', async (message) => {
|
|
| 190 |
const args = message.content.slice(prefix.length).trim().split(/ +/);
|
| 191 |
const commandName = args.shift().toLowerCase();
|
| 192 |
|
| 193 |
-
const allCommands = [...commandsData.map(c => c.name), 'sync', 'sync_cmds', 'reboot', 'grantservers', 'servers', 'help', 'motm', 'profileimage'];
|
| 194 |
if (allCommands.includes(commandName)) {
|
| 195 |
logTransaction(client, commandName, message.author, message.guild, message.member);
|
| 196 |
}
|
|
@@ -327,6 +328,18 @@ client.on('messageCreate', async (message) => {
|
|
| 327 |
await message.reply("🔓 Channel Unlocked.");
|
| 328 |
}
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
if (commandName === 'post') {
|
| 331 |
if (!message.member.permissions.has('Administrator')) return message.reply("❌ Admin Only");
|
| 332 |
const text = args.join(' ');
|
|
|
|
| 74 |
{ name: 'profileimage', description: 'Generate a high-quality visual profile card', options: [{ name: 'user', type: 6, description: 'The user to check', required: false }] },
|
| 75 |
{ name: 'giverole', description: 'Give a role to members (Admin)', options: [{ name: 'role', type: 8, description: 'The role', required: true }] },
|
| 76 |
{ name: 'uptime', description: 'Show how long the bot has been online' },
|
| 77 |
+
{ name: 'motm', description: 'Award Man of the Match to a player', options: [{ name: 'player', type: 6, description: 'The player to award', required: true }] },
|
| 78 |
+
{ name: 'settimezone', description: 'Set server timezone offset (e.g. 3 for UTC+3)', options: [{ name: 'offset', type: 4, description: 'Hours from UTC', required: true }] }
|
| 79 |
];
|
| 80 |
|
| 81 |
client.once('ready', async () => {
|
|
|
|
| 191 |
const args = message.content.slice(prefix.length).trim().split(/ +/);
|
| 192 |
const commandName = args.shift().toLowerCase();
|
| 193 |
|
| 194 |
+
const allCommands = [...commandsData.map(c => c.name), 'sync', 'sync_cmds', 'reboot', 'grantservers', 'servers', 'help', 'motm', 'profileimage', 'settimezone'];
|
| 195 |
if (allCommands.includes(commandName)) {
|
| 196 |
logTransaction(client, commandName, message.author, message.guild, message.member);
|
| 197 |
}
|
|
|
|
| 328 |
await message.reply("🔓 Channel Unlocked.");
|
| 329 |
}
|
| 330 |
|
| 331 |
+
if (commandName === 'settimezone') {
|
| 332 |
+
if (!message.member.permissions.has('Administrator')) return message.reply("❌ Admin Only");
|
| 333 |
+
const offset = parseInt(args[0]);
|
| 334 |
+
if (isNaN(offset)) return message.reply("❌ Please provide a valid number (e.g. `!settimezone 3`)!");
|
| 335 |
+
|
| 336 |
+
if (!storage.data.config[message.guildId]) storage.data.config[message.guildId] = {};
|
| 337 |
+
storage.data.config[message.guildId].timezone = offset;
|
| 338 |
+
storage.save('config');
|
| 339 |
+
|
| 340 |
+
await message.reply(`✅ Timezone set to **UTC${offset >= 0 ? '+' : ''}${offset}**. All match times will now be adjusted correctly.`);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
if (commandName === 'post') {
|
| 344 |
if (!message.member.permissions.has('Administrator')) return message.reply("❌ Admin Only");
|
| 345 |
const text = args.join(' ');
|