Add config option for prefixes
This commit is contained in:
parent
9e9cf31329
commit
f34cd8e427
4 changed files with 8 additions and 3 deletions
|
@ -110,6 +110,8 @@ The container is locked down, so there is no networking, limited memory and CPU
|
||||||
- `owner` - The owner(s) of the bot.
|
- `owner` - The owner(s) of the bot.
|
||||||
Use an array for multiple owners.
|
Use an array for multiple owners.
|
||||||
- `token` - The bot token.
|
- `token` - The bot token.
|
||||||
|
- `prefix` - The prefix for commands.
|
||||||
|
- `codePrefix` - The prefix for code evaluation.
|
||||||
- `languages` Languages to use.
|
- `languages` Languages to use.
|
||||||
The language names here are different from the user-facing ones.
|
The language names here are different from the user-facing ones.
|
||||||
Check the folders in `docker/` for the language names.
|
Check the folders in `docker/` for the language names.
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"owner": "12345678901234",
|
"owner": "12345678901234",
|
||||||
"token": "MTU1fdsYNTRb2RT.FcD2l1ig.jIuKqwertyd432RROhF5A",
|
"token": "MTU1fdsYNTRb2RT.FcD2l1ig.jIuKqwertyd432RROhF5A",
|
||||||
|
"prefix": ">",
|
||||||
|
"codePrefix": ">",
|
||||||
"languages": [
|
"languages": [
|
||||||
"haskell",
|
"haskell",
|
||||||
"python",
|
"python",
|
||||||
|
|
|
@ -59,8 +59,9 @@ class MessageInvalidListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMessage(message) {
|
parseMessage(message) {
|
||||||
const regex1 = /^\s*>\s*(.+?)?\s*```(.+?)\n([^]+)```\s*$/;
|
const prefix = this.client.config.codePrefix.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
const regex2 = /^\s*>\s*(.+?)?\s*`(.+?) \s*([^]+)`\s*$/;
|
const regex1 = new RegExp(`^\\s*${prefix}\\s*(.+?)?\\s*\`\`\`(.+?)\\n([^]+)\`\`\`\\s*$`);
|
||||||
|
const regex2 = new RegExp(`^\\s*${prefix}\\s*(.+?)?\\s*\`(.+?) \\s*([^]+)\`\\s*$`);
|
||||||
const match = message.content.match(regex1) || message.content.match(regex2);
|
const match = message.content.match(regex1) || message.content.match(regex2);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CompilerClient extends AkairoClient {
|
||||||
|
|
||||||
this.commandHandler = new CommandHandler(this, {
|
this.commandHandler = new CommandHandler(this, {
|
||||||
directory: path.join(__dirname, '../commands'),
|
directory: path.join(__dirname, '../commands'),
|
||||||
prefix: '>',
|
prefix: config.prefix,
|
||||||
allowMention: true,
|
allowMention: true,
|
||||||
commandUtil: true,
|
commandUtil: true,
|
||||||
commandUtilLifetime: 3e5,
|
commandUtilLifetime: 3e5,
|
||||||
|
|
Loading…
Reference in a new issue