blockmine 1.16.3 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -175,14 +175,19 @@ process.on('message', async (message) => {
175
175
 
176
176
  if (config.proxyHost && config.proxyPort) {
177
177
  sendLog(`[System] Используется прокси: ${config.proxyHost}:${config.proxyPort}`);
178
+
179
+ // Очищаем пароль от лишних символов
180
+ const cleanProxyPassword = config.proxyPassword ? config.proxyPassword.trim() : null;
181
+ const cleanProxyUsername = config.proxyUsername ? config.proxyUsername.trim() : null;
182
+
178
183
  botOptions.connect = (client) => {
179
184
  SocksClient.createConnection({
180
185
  proxy: {
181
186
  host: config.proxyHost,
182
187
  port: config.proxyPort,
183
188
  type: 5,
184
- userId: config.proxyUsername,
185
- password: config.proxyPassword
189
+ userId: cleanProxyUsername,
190
+ password: cleanProxyPassword
186
191
  },
187
192
  command: 'connect',
188
193
  destination: {
@@ -194,6 +199,7 @@ process.on('message', async (message) => {
194
199
  client.emit('connect');
195
200
  }).catch(err => {
196
201
  sendLog(`[Proxy Error] ${err.message}`);
202
+ sendLog(`[Debug] Full proxy error: ${JSON.stringify(err)}`);
197
203
  client.emit('error', err);
198
204
  });
199
205
  }
@@ -712,25 +718,39 @@ process.on('message', async (message) => {
712
718
  const { commandName, username, typeChat } = message;
713
719
  const commandInstance = bot.commands.get(commandName);
714
720
  if (commandInstance) {
715
- commandInstance.onInsufficientPermissions(bot, typeChat, { username });
721
+ if (commandInstance.onInsufficientPermissions !== Command.prototype.onInsufficientPermissions) {
722
+ commandInstance.onInsufficientPermissions(bot, typeChat, { username });
723
+ } else {
724
+ bot.api.sendMessage(typeChat, `У вас нет прав для выполнения команды ${commandName}.`, username);
725
+ }
716
726
  }
717
727
  } else if (message.type === 'handle_wrong_chat') {
718
728
  const { commandName, username, typeChat } = message;
719
729
  const commandInstance = bot.commands.get(commandName);
720
730
  if (commandInstance) {
721
- commandInstance.onWrongChatType(bot, typeChat, { username });
731
+ if (commandInstance.onWrongChatType !== Command.prototype.onWrongChatType) {
732
+ commandInstance.onWrongChatType(bot, typeChat, { username });
733
+ } else {
734
+ bot.api.sendMessage('private', `Команду ${commandName} нельзя использовать в этом типе чата - ${typeChat}.`, username);
735
+ }
722
736
  }
723
737
  } else if (message.type === 'handle_cooldown') {
724
738
  const { commandName, username, typeChat, timeLeft } = message;
725
739
  const commandInstance = bot.commands.get(commandName);
726
740
  if (commandInstance) {
727
- commandInstance.onCooldown(bot, typeChat, { username }, timeLeft);
741
+ if (commandInstance.onCooldown !== Command.prototype.onCooldown) {
742
+ commandInstance.onCooldown(bot, typeChat, { username }, timeLeft);
743
+ } else {
744
+ bot.api.sendMessage(typeChat, `Команду ${commandName} можно будет использовать через ${timeLeft} сек.`, username);
745
+ }
728
746
  }
729
747
  } else if (message.type === 'handle_blacklist') {
730
748
  const { commandName, username, typeChat } = message;
731
749
  const commandInstance = bot.commands.get(commandName);
732
750
  if (commandInstance) {
733
- commandInstance.onBlacklisted(bot, typeChat, { username });
751
+ if (commandInstance.onBlacklisted !== Command.prototype.onBlacklisted) {
752
+ commandInstance.onBlacklisted(bot, typeChat, { username });
753
+ }
734
754
  }
735
755
  } else if (message.type === 'action') {
736
756
  if (message.name === 'lookAt' && bot && message.payload.position) {
@@ -19,6 +19,26 @@ class DevCommand extends Command {
19
19
  });
20
20
  }
21
21
 
22
+ // Переопределяем метод для кастомного сообщения при отсутствии прав
23
+ onInsufficientPermissions(bot, typeChat, user) {
24
+ bot.api.sendMessage(typeChat, `${user.username}, у вас нет прав для этой команды.`, user.username);
25
+ }
26
+
27
+ // Переопределяем метод для неправильного типа чата
28
+ onWrongChatType(bot, typeChat, user) {
29
+ bot.api.sendMessage('private', `${user.username}, команду dev нельзя использовать в чате типа "${typeChat}"`, user.username);
30
+ }
31
+
32
+ // Переопределяем метод для кулдауна
33
+ onCooldown(bot, typeChat, user, timeLeft) {
34
+ bot.api.sendMessage(typeChat, `${user.username}, подождите еще ${timeLeft} секунд перед повторным использованием команды.`, user.username);
35
+ }
36
+
37
+ // Переопределяем метод для черного списка (по умолчанию ничего не отправляется)
38
+ onBlacklisted(bot, typeChat, user) {
39
+ bot.api.sendMessage(typeChat, `${user.username}, вы находитесь в черном списке.`, user.username);
40
+ }
41
+
22
42
  async handler(bot, typeChat, user) {
23
43
  if (!appVersion) {
24
44
  try {