pokemon-showdown/chat-plugins/thehappyplace.js
Morfent 062f56ddd2 Chat plugins: mute/lock checks, add remaining help docs...
Letting users that can't talk use the more important commands is fine
and all, until they find a way to spam with them.

- Remove redundant this.canBroadcast call in /aotd
- The response after changing the Quote of the Day uses the proper
  broadcast style
- /aotd viewnoms sorts the prenomination list
- /trivia qs acknowledges that Video Games is a category
- Change suggestions to use the deprecated /trivia help command to /help
  trivia
- Add style fixes used in the Trivia to the The Happy Place and The Studio
  plugins
2015-05-05 22:43:33 -03:00

45 lines
1.9 KiB
JavaScript

/**
* The Happy Place: Quote of the Day Plugin
* This is a command that allows a room owner to set an inspirational "quote" of the day.
* Others may braodcast this at any time to remind the room of such.
* Only works in a room with the id "thehappyplace"
* Credits: panpawn, TalkTakesTime, Morfent, and sirDonovan
*/
exports.commands = {
quoteoftheday: 'qotd',
qotd: function (target, room, user) {
if (room.id !== 'thehappyplace') return this.sendReply("This command can only be used in The Happy Place.");
if (!room.chatRoomData) return;
if (!target) {
if (!this.canBroadcast()) return;
if (!room.chatRoomData.quote) return this.sendReplyBox("The Quote of the Day has not been set.");
return this.sendReplyBox(
"The current <strong>Inspirational Quote of the Day</strong> is:<br />" +
"\"" + room.chatRoomData.quote + "\""
);
}
if (!this.can('declare', null, room)) return false;
if (target === 'off' || target === 'disable' || target === 'reset') {
if (!room.chatRoomData.quote) return this.sendReply("The Quote of the Day has already been reset.");
delete room.chatRoomData.quote;
this.sendReply("The Quote of the Day was reset by " + Tools.escapeHTML(user.name) + ".");
this.logModCommand(user.name + " reset the Quote of the Day.");
Rooms.global.writeChatRoomData();
return;
}
room.chatRoomData.quote = Tools.escapeHTML(target);
Rooms.global.writeChatRoomData();
room.addRaw(
"<div class=\"broadcast-blue\"><strong>The Inspirational Quote of the Day has been updated by " + Tools.escapeHTML(user.name) + ".</strong><br />" +
"Quote: " + room.chatRoomData.quote + "</div>"
);
this.logModCommand(Tools.escapeHTML(user.name) + " updated the quote of the day to \"" + room.chatRoomData.quote + "\".");
},
quoteofthedayhelp: 'qotdhelp',
qotdhelp: [
"/qotd - View the current Inspirational Quote of the Day.",
"/qotd [quote] - Set the Inspirational Quote of the Dat. Requires: # & ~"
]
};