Skip to content

Commit

Permalink
Merge pull request #1 from MEFRREEX/1.5.0
Browse files Browse the repository at this point in the history
refactor: full bot refactor
  • Loading branch information
MEFRREEX authored Oct 3, 2024
2 parents bcef1da + 2346963 commit 9b8936b
Show file tree
Hide file tree
Showing 68 changed files with 1,390 additions and 1,250 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compiled class file
*.class
.gradle/
build/
bin/
target/
.idea/
.vscode/

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
13 changes: 0 additions & 13 deletions .idea/compiler.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/encodings.xml

This file was deleted.

25 changes: 0 additions & 25 deletions .idea/jarRepositories.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

90 changes: 0 additions & 90 deletions .idea/workspace.xml

This file was deleted.

76 changes: 64 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
# Vk-Rcon-Bot
Simple bot for VK to send commands to the server using RCON

![example](https://i.imgur.com/DH8hsSV.png)
A simple bot for sending commands to a Minecraft server via RCON through the VK platform.

## 📃 Used libraries:
- [vk-java-sdk](https://github.com/VKCOM/vk-java-sdk)
- [snakeyaml](https://github.com/snakeyaml/snakeyaml)
- [rkon-core](https://github.com/kr5ch/rkon-core)
## 🚀 Features
- Sends RCON commands to a server directly from VK messages.
- Easy setup and configuration.
- Lightweight and simple to use.
- **Multilingual support**: The bot supports multiple languages, with easy customization of all messages.
- **Command prefix**: Ability to specify a custom prefix for commands.
- **Quick commands**: Add predefined quick commands for frequent actions.
- **Command blocking**: Option to block specific unwanted commands from being executed.

## 🎮 Running the Bot
1. Download the latest release of the bot.
2. Run the following command to start the bot:
```bash
java -jar VkRconBot-<Version>.jar
```

## 🛠 Build JAR file
- `git clone https://github.com/MEFRREEX/Vk-Rcon-Bot.git`
- `cd Vk-Rcon-Bot`
- `mvn clean package`
## ⚙️ Configuration
After the first run of the bot, a configuration file config.yml will be generated. You will need to edit this file before the bot can function properly.
```yaml
# Available languages: eng (English), rus (Русский)
language: "rus"

## 🎮 Run
`java -jar VkRconBot-1.4.jar`
# VK settings
vk:
groupId: 123 # VK group Id
accessToken: "token" # VK group token

# RCON settings
rcon:
host: "localhost" # RCON address
port: 19132 # RCON port
password: "password" # RCON password

# Command settings
commands:
# A character before the command to send the command. For example '/'.
# Leave blank if not required.
prefix: '/'

# Fast commands
# (Displayed when “Start”, “Rcon” is entered)
fast-commands: ["ver", "status", "stop"]

# Blocked commands
blocked-commands: ["stop"]
```
## 🛠 Building the JAR File
To build the project from source:
1. Clone the repository:
```bash
git clone https://github.com/MEFRREEX/Vk-Rcon-Bot.git
```
2. Navigate to the project directory:
```bash
cd Vk-Rcon-Bot
```
3. Build the JAR file using Gradle:
```bash
gradle build
```

## 📄 Dependencies
The project uses the following libraries:
- [Vk-Java-Sdk](https://github.com/VKCOM/vk-java-sdk) - for VK API integration.
- [Configuration](https://github.com/MEFRREEX/Configuration) - for managing configuration files.
72 changes: 72 additions & 0 deletions README_ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Vk-Rcon-Bot

Простой бот для отправки команд на сервер через RCON с помощью платформы ВКонтакте.

## 🚀 Основные возможности
- Отправка команд на сервер через RCON из сообщений ВКонтакте.
- Простая настройка и конфигурация.
- Лёгкий в использовании.
- **Поддержка нескольких языков**: Бот поддерживает несколько языков с простой настройкой всех сообщений.
- **Префикс для команд**: Возможность указать префикс для команд.
- **Быстрые команды**: Возможность добавить заранее настроенные быстрые команды для частых действий.
- **Блокировка команд**: Возможность заблокировать нежелательные для использования команды.


## 🎮 Запуск бота
1. Скачайте последнюю версию бота.
2. Запустите следующую команду для старта бота:
```bash
java -jar VkRconBot-<Версия>.jar
```

## ⚙️ Конфигурация
После первого запуска бота будет сгенерирован файл конфигурации config.yml. Вам необходимо отредактировать этот файл перед дальнейшим использованием бота.

```yaml
# Доступные языки: eng (English), rus (Русский)
language: "rus"

# Настройки VK
vk:
groupId: 123 # Id группы ВК
accessToken: "token" # Токен группы ВК

# Настройки RCON
rcon:
host: "localhost" # Адрес RCON
port: 19132 # Порт RCON
password: "password" # Пароль RCON

# Настройки команд
commands:
# Символ перед командой для отправки комманды. Например '/'.
# Оставьте пустым если не требуется.
prefix: '/'

# Быстрые команды
# (Отображаются при вводе "Начать", "Rcon")
fast-commands: ["ver", "status", "stop"]

# Заблокированные команды
blocked-commands: ["stop"]
```
## 🛠 Сборка JAR-файла
Чтобы собрать проект из исходного кода:
1. Клонируйте репозиторий:
```bash
git clone https://github.com/MEFRREEX/Vk-Rcon-Bot.git
```
2. Перейдите в директорию проекта:
```bash
cd Vk-Rcon-Bot
```
3. Соберите JAR-файл с помощью Gradle:
```bash
gradle build
```

## 📄 Зависимости
Проект использует следующие библиотеки:
- [Vk-Java-Sdk](https://github.com/VKCOM/vk-java-sdk) - для интеграции с API ВКонтакте.
- [Configuration](https://github.com/MEFRREEX/Configuration) - для управления файлами конфигурации.
11 changes: 11 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
kotlin("jvm") version "1.9.21"
}

tasks.withType<Jar> {
archiveFileName.set("Vk-Rcon-Bot-API-${project.version}.jar")
}

kotlin {
jvmToolchain(17)
}
7 changes: 7 additions & 0 deletions api/src/main/kotlin/com/mefrreex/vkbot/command/Command.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.mefrreex.vkbot.command

abstract class Command(
val name: String,
val description: String = "",
val aliases: Array<String> = emptyArray()
)
14 changes: 14 additions & 0 deletions api/src/main/kotlin/com/mefrreex/vkbot/command/CommandService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mefrreex.vkbot.command

interface CommandService {

fun getCommands(): Map<String, Command>

fun getCommand(name: String): Command?

fun register(vararg commands: Command) {
commands.forEach { register(it)}
}

fun register(command: Command)
}
Loading

0 comments on commit 9b8936b

Please sign in to comment.