-
Notifications
You must be signed in to change notification settings - Fork 305
On using VChat Filters
Whenever you use to_chat() to output a message to one or more things, please use a <span class=''> (Or a span() proc call) to provide it with one or more class tags. Any class tags that a particular filter matches against will cause the contained message to be affected by that filter. I've listed the original filters (As of us getting VChat) below, and those include the class tags that filter to each. So a to_chat(mob/M, "<span class='pm warning'>message</span>")
will be caught by both the adminPM
AND warning
filters (I believe inclusively).
- Ater
With all that said, here's a copy of a comment from the original VChat PR for us that explains it fairly well:
Because I just thought of it, and since I personally can't catch it in live tests because devs don't get admin logs (and I'm our only just-a-dev), can admin logs, debug logs, etc, be filtered, and if so what filters do they go to?
And semi-related, what's actually involved in adding new filters?
Don't know actually. Filtering is done based on the first <span> tag in the message vchat gets from Byond, and the classes it has on it. If you look in vchat.js, there's an array of the categories:
//The table to map game css classes to our vchat categories
type_table: [
{
matches: ".say, .emote",
becomes: "vc_localchat",
pretty: "Local Chat",
tooltip: "In-character local messages (say, emote, etc)",
required: false,
admin: false
},
{
matches: ".alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",
becomes: "vc_radio",
pretty: "Radio Comms",
tooltip: "All departments of radio messages",
required: false,
admin: false
},
{
matches: ".notice, .adminnotice, .info, .sinister, .cult",
becomes: "vc_info",
pretty: "Notices",
tooltip: "Non-urgent messages from the game and items",
required: false,
admin: false
},
{
matches: ".critical, .danger, .userdanger, .warning, .italics",
becomes: "vc_warnings",
pretty: "Warnings",
tooltip: "Urgent messages from the game and items",
required: false,
admin: false
},
{
matches: ".deadsay",
becomes: "vc_deadchat",
pretty: "Deadchat",
tooltip: "All of deadchat",
required: false,
admin: false
},
{
matches: ".ooc:not(.looc)",
becomes: "vc_globalooc",
pretty: "Global OOC",
tooltip: "The bluewall of global OOC messages",
required: false,
admin: false
},
//VOREStation Add Start
{
matches: ".nif",
becomes: "vc_nif",
pretty: "NIF Messages",
tooltip: "Messages from the NIF itself and people inside",
required: false,
admin: false
},
//VOREStation Add End
{
matches: ".pm",
becomes: "vc_adminpm",
pretty: "Admin PMs",
tooltip: "Messages to/from admins ('adminhelps')",
required: false,
admin: false
},
{
matches: ".admin_channel",
becomes: "vc_adminchat",
pretty: "Admin Chat",
tooltip: "ASAY messages",
required: false,
admin: true
},
{
matches: ".mod_channel",
becomes: "vc_modchat",
pretty: "Mod Chat",
tooltip: "MSAY messages",
required: false,
admin: true
},
{
matches: ".event_channel",
becomes: "vc_eventchat",
pretty: "Event Chat",
tooltip: "ESAY messages",
required: false,
admin: true
},
{
matches: ".ooc.looc, .ooc .looc", //Dumb game
becomes: "vc_looc",
pretty: "Local OOC",
tooltip: "Local OOC messages, always enabled",
required: true
},
{
matches: ".boldannounce",
becomes: "vc_system",
pretty: "System Messages",
tooltip: "Messages from your client, always enabled",
required: true
}
]
You can add any new filters there. Matches is a CSS selector to check that first <span> tag against. Becomes is the name of the category it's assigned in vchat (just needs to be unique) Pretty is the name it gets on the slider toggles in the settings page Tooltip is the tooltip when you mouse over said slider toggle Required means it's mandatory on every tab Admin means it only shows up for admins (purely a convenience feature to keep the list smaller for non-admins, this is not a security feature)
If you're not happy with where a message from the game goes, you'd want to change that at the source of the message, wherever in code that is, to use the proper span classes you think it should use.
(I should note that by 'admin' I meant staff, anyone with any client.holder)