Add includeChats property#323
Open
CodeRedDev wants to merge 2 commits intoTeam-Silver-Sphere:masterfrom
Open
Conversation
59405d2 to
84c28b1
Compare
Contributor
|
I was about to do another PR which might be in conflict to yours, maybe you can add it here too instead? Add the ability for "commands" option to accept an array or just a single string. {
"command": [
"claim",
"claimrule"
],
"type": "broadcast",
"response": "To make a valid claim, name your squad after the vehicle you want to claim.\nIf there are multiple vehicles of the same type, the first squad to claim it gets priority.",
"ignoreChats": [
"ChatAll",
"ChatTeam",
"ChatSquad"
]
}, async mount() {
for (const command of this.options.commands) {
const commands = Array.isArray(command.command) ? command.command : [command.command];
for (const cmd of commands) {
this.server.on(`CHAT_COMMAND:${cmd.toLowerCase()}`, async (data) => {
if (command.ignoreChats.includes(data.chat)) return;
if (command.type === 'broadcast') {
await this.server.rcon.broadcast(command.response);
} else if (command.type === 'warn') {
await this.server.rcon.warn(data.player.steamID, command.response);
}
});
}
}
} |
Contributor
Author
|
@sergelouie6 although it's a nice feature I doubt that they should be mixed in one PR |
Thomas-Smyth
requested changes
Jul 18, 2024
| <ul><li><h4>commands</h4> | ||
| <h6>Description</h6> | ||
| <p>An array of objects containing the following properties: <ul><li><code>command</code> - The command that initiates the message.</li><li><code>type</code> - Either <code>warn</code> or <code>broadcast</code>.</li><li><code>response</code> - The message to respond with.</li><li><code>ignoreChats</code> - A list of chats to ignore the commands in. Use this to limit it to admins.</li></ul></p> | ||
| <p>An array of objects containing the following properties: <ul><li><code>command</code> - The command that initiates the message.</li><li><code>type</code> - Either <code>warn</code> or <code>broadcast</code>.</li><li><code>response</code> - The message to respond with.</li><li><code>ignoreChats/includeChats</code> - Either one can be used to limit to specific in-game chats, being <code>ChatAll</code>, <code>ChatTeam</code>, <code>ChatSquad</code> and <code>ChatAdmin</code></li></ul></p> |
Collaborator
There was a problem hiding this comment.
Were these changes made manually? If so, they will be overwritten when the readme is regenerated from the plugin option specification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
includeChatsproperty toChatCommands.This makes limiting commands to one specific channel much easier and cleaner in the configuration.
I saw that there are more modules with the
ignoreChatsproperty and if the newincludeChatsproperty is desired, I will make efforts to implement it for those other modules too.