2024-11-09 14:22:29 -06:00

63 lines
3.1 KiB
Markdown

# onequestionmark-chat
**onequestionmark** is a Discord bot written in Haxe.
## Name origin
Following the established naming scheme of Maralis and Derxwna's fivequestionmarks and Kuschelyagi's [tenquestionmarks](https://forge.ds8.zone/elsanctum/tenquestionmarks), onequestionmark is named after the glitch Pokémon known only as ["?"](https://bulbapedia.bulbagarden.net/wiki/%3F_(glitch_Pokémon)) (which amusingly has *two* question marks as its sprite).
"onequestionmark" is never capitalized.
## Configuration
A `settings.json` file is required to run the bot. An example is provided below:
```
{
"motd": {
"date": "",
"time": 8,
"channels": [],
"previous": [0,0,0,0,0,0,0]
},
"debug": false,
"devmode": false,
"devchannel": "000000000000000000",
"botowner": "000000000000000000",
"devserver": "000000000000000000",
"token": "fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf"
}
```
- onequestionmark will handle most of the `motd` values itself.
- `date` and `previous` are modified by the bot during normal operations.
- `time` determines the hour at which the MOTD is posted (24-hour notation, local time).
- Using the `?motd` command adds the current channel to the `channels` array.
- `debug` determines whether HxDiscord's console debug messages are enabled.
- `devmode` restricts the bot's responses to the specified dev server.
- `devchannel`, `devserver`, and `botowner` must be filled with the appropriate numerical values. These values can be seen easily in Discord's URLs.
- `token` is your Discord bot app token. Don't share it.
An `echobox-db.json` file will also be generated by onequestionmark upon starting if it fails to find one.
The `motd-db.json`, `yesno-db.json`, and `hug-db.json` files provided in this repo are examples that will need to be replaced with correct data. Any of these three files can also be removed. If onequestionmark cannot find one of these files at startup, the bot will simply disable the corresponding function.
`settings.json` and `echobox-db.json` are the only files modified by the bot during operation. As they can contain sensitive data, they are excluded from Git tracking.
## Building from source
### Requirements
- [Haxe Programming Language](https://haxe.org/)
- [HxDiscord](https://github.com/furretpaws/hxdiscord) by FurretPaws
- [IzzComLib](https://forge.ds8.zone/Izwzyzx/IzzComLib) by Izwzyzx
Install the libraries [from their git repositories](https://lib.haxe.org/documentation/using-haxelib/#git).
### Compiling
Navigate to the project folder in a terminal and run `haxe hxbuild.hxml`. This will generate `onequestionmark.n` in the export folder.
The provided `hxbuild.hxml` file is set up to immediately run the bot after compiling.
## Running
`neko onequestionmark.n`
onequestionmark is designed and tested to run in [NekoVM](https://nekovm.org/download/) (included with Haxe). Other Haxe targets not guaranteed to work (see HxDiscord library's compatibility).
`onequestionmark.n` should be placed in the same directory as its JSON files.
It is preferable to stop the bot via its own `?quit` command in Discord, so it can save its settings file before exiting.