@ayanaware/bentocord

中文文档
1.0.0-beta.62发布于 2023/07/21MITTypeScriptESM + CJS近 30 天下载 1.8万

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.

原始使用文档
文档目录4 节
  1. @ayanaware/bentocord
  2. Bootstrap
  3. Bentocord Variables
  4. Bentocord Interface

@ayanaware/bentocord npm (scoped) Discord install size

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots. But stay powerful enough that you never have to leave

Bootstrap

With most things Bento you have a lot of options when bootstrapping Bentocord. However we highly recommend usings Bento's Application helper. It is the most painless way to get up and running:

import { Application } from '@ayanaware/bento';
import { Bentocord } from '@ayanaware/bentocord';

// Create our Application instance
const app = new Application();

// Anonymous async function so we can use await
(async () => {
    await app.start();

    // Add Bentocord
    await app.bento.addPlugin(Bentocord);

    await app.verify();
})().catch(e => {
    console.log(e);
    process.exit(1);
});

Bentocord Variables

Bento variables are used to change the behavior of Bentocord. They can be set various different ways. Some common ways are to use Bento's built in VariableLoader or VariableFileLoader plugins. You can also bring your own plugin or alternativly directly inject values via Bento.setVariable().

Note: While some variables are dynamic and Bentocord reacts as soon as you update them. Some are not. This means Bentocord expects you to set all Variables you care about before Bento.addPlugin()

KeyTypeDescriptionDefault
BENTOCORD_TOKENstringDiscord Authentication Tokennull
BENTOCORD_BOT_OWNERSlist*Discord user id listnull
BENTOCORD_IGNORE_MODEbooleanThis will disable much of the bot for users not in BENTOCORD_BOT_OWNERSfalse
BENTOCORD_COMMAND_PREFIXstringThe default prefix to use for Bentocord's Command Handlerbentocord
BENTOCORD_ACTIVITY_NAMEstringThe default activity name to set per shardwith Bentocord
BENTOCORD_BUILTIN_COMMANDSbooleanShould Bentocord load it's built-in Commands (ex: ping, bento)true

* = comma seperated list of items

Bentocord Interface

Bentocord uses a replaceable entity, BentocordInterface, to offer extendable functionality. Bentocord tries to offer sane defaults but for things like Storage, Localization, and other Application specific features you will need to provide a replacement entity. I often refer to this replacement entity as BentocordOverride.

It should be easy enough to implement your BentocordOverride. Simply create a normal Bento Entity. Extend BentocordInterface and override functions you wish to take control over. You can find all the functions and their description here. Then simply make use of bento.replaceEntity().

IMPORTANT: A BentocordOverride implementation should include basic caching for many of the possibly "expensive" calls. Such as getPrefix, formatTranslation, and many more. Functions such as these can and will be hit many times a second, and only increase as your bot grows. Some of these call's even take place on MESSAGE_CREATE. It is extreamly bad practice to hit your backend every call. Both for your backends sake and application responsiveness to your users. So add some caching :)

版本与发布记录

@ayanaware/bentocord 共发布 62 个版本,首次发布于 2020/10/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-beta.62latest2023/07/213 年前
1.0.0-beta.612023/05/083 年前
1.0.0-beta.602022/09/174 年前
1.0.0-beta.592022/09/144 年前
1.0.0-beta.582022/08/084 年前
1.0.0-beta.572022/08/084 年前

关于 @ayanaware/bentocord 的常见问题

@ayanaware/bentocord 是什么?

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.

如何安装 @ayanaware/bentocord?

在项目目录运行 npm install @ayanaware/bentocord,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@ayanaware/bento(^1.0.0-rc.29)、eris(^0.17.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ayanaware/bentocord 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ayanaware/bentocord 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ayanaware/bentocord 可以商用吗?

@ayanaware/bentocord 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ayanaware/bentocord 的下载量有多少?

根据 npm 官方下载统计,@ayanaware/bentocord 在 2026/10/08 – 2026/11/06 这 30 天内被下载 17,918 次,日均约 597 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ayanaware/bentocord 还在维护吗?

最新版本 1.0.0-beta.62 发布于 2023/07/21(3 年前);至今共发布 62 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/10/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。