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

Commit

Permalink
Merge pull request #100 from xia-mc/v14-dev
Browse files Browse the repository at this point in the history
中国語のREADME_CN.mdを追加。
  • Loading branch information
ringo360 authored May 9, 2024
2 parents 4f16226 + e6ffdc0 commit 5e45ffa
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

![Alt](https://repobeats.axiom.co/api/embed/b7fc33791d3233660e7c02524ace22c31b66e890.svg "Repobeats analytics image")

[简体中文](README_CN.md)

## What's this?
discord.js@v14を使用した、多機能botです。
Expand Down
87 changes: 87 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<div align="center">

# Sekai.explode

一种基于 **discord.js V14** 的多功能机器人。

![Alt](https://repobeats.axiom.co/api/embed/b7fc33791d3233660e7c02524ace22c31b66e890.svg "Repobeats analytics image")

</div>

## 这是什么?
一种基于 [```discord.js V14```](https://discord.js.org/) 开发的多功能Discord机器人。

项目的初衷是方便初学者使用,易于添加和删除功能。

## 快速开始
本项目作为一个公共机器人全天候运行,点击[此处](https://discord.com/api/oauth2/authorize?client_id=1144600133762293800&permissions=8&scope=bot)以快速添加到你的服务器。

## 本地部署
### 环境要求
- 已安装 [```Node.js```](https://nodejs.org/en) (推荐使用 v18 或更高版本)
- 已安装 [```Npm```](https://www.npmjs.com/)[```Yarn```](https://yarnpkg.com/)
- 已安装 [```Git```](https://git-scm.com/)
- **可选)** 已安装 [```pm2```](https://pm2.io/)
> ⚠ 如果 PM2 不可用,```/update``` 命令将无法运行。
### 开始部署

> ⚠ 开始部署前请先检查环境要求。
1. 运行 `git clone` 克隆此版本库。
2. 运行 `npm install` 安装依赖项。
3. 复制 `config.json.example` 并重命名为 `config.json`
4. 编辑 `config.json`
5. 使用 `npm start``pm2 start npm -- start` 启动。
6. 大功告成!


### 注册命令

#### ```misc```软件包添加
只需要在```packages/misc/commands```目录下创建你的文件,启动时会自动加载。

**例:**
```js
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('hello')
.setDescription('Hello World!'),
execute: async function (interaction) {
// 在这里开始你的代码 ↓
await interaction.reply('Hello World!')
}
};
```

### 添加软件包
`packages` 目录下创建一个工作区,软件包会自动加载。
```sh
npm init -w packages/example
```

在入口点文件(如 ```index.js```)中添加命令并导出功能。

**例:**
```js
const { CommandManager } = require('../../internal/commands');
const upload = require('./upload');

class ExampleFeature {
onLoad() {
CommandManager.default.addCommands({
data: new SlashCommandBuilder()
.setName('hello')
.setDescription('Hello World!'),
execute: async function (interaction) {
// 在这里开始你的代码 ↓
await interaction.reply('Hello World!')
}
});
}
}

module.exports = { feature: new ExampleFeature() };
```

0 comments on commit 5e45ffa

Please sign in to comment.