Skip to content

Instantly share code, notes, and snippets.

View matthewjohnston4's full-sized avatar

Matthew Johnston matthewjohnston4

View GitHub Profile
@matthewjohnston4
matthewjohnston4 / README.md
Last active May 26, 2021 10:36
Nightbot shoutout command with customised per-user messages

This two-piece code will allow you to setup a Nightbot shoutout command which can be customised to allow per-user shoutout messages, with a fallback default message.

Because Nightbot commands have a character limit, you won't get far with including the custom messages directly in your command string.

The solution is to use Nightbots urlfetch variable to fetch a JSON object filled with custom messages from somewhere on the web — here I'm placing it in a Github Gist (which works fine, but a bit slowly). You could put it somewhere on a plain old HTTP page served anywhere on the internet.

How to use

  1. Clone this JSON: https://gist.github.com/matthewjohnston4/ef62107655e471384fe027e0738a5c05 and store it where you want.
  2. Customise the JSON object to add or remove any "username": "shoutout message" combinations you want (don't forget those trailing commas).
{
"Limmy": "Shoutout to Master of Flash Limmy — https://www.twitch.tv/limmy",
"Username_2": "Shoutout to some other user",
"Tester": "Test shoutout",
}
@matthewjohnston4
matthewjohnston4 / nightbot_custom_shoutouts.js
Last active May 25, 2021 21:52
Nightbot shoutout custom text per username
!commands add !so $(eval name="$(query)" ?? "default";shoutouts=$(urlfetch json https://gist.githubusercontent.com/matthewjohnston4/ef62107655e471384fe027e0738a5c05/raw/f260c49f7fb7a07e0fc199f41d1b1b8ab765ac10/shoutout_messages.json);(name in shoutouts) ? shoutouts[name] : "This is the default shoutout message to $(query)")
@matthewjohnston4
matthewjohnston4 / shoutouts.js
Last active May 25, 2021 21:39
Nightbot Shoutout messages
queryUser;

Tweet by Professor Philip Nolan on September 18th, 2020:

It is reasonable to ask: why close restaurants and pubs if there are so few outbreaks associated with those environments? However, this is misreading and misinterpreting the data on outbreaks and clusters.

If I went out 5 days ago and caught the virus in a restaurant, it will have multiplied silently inside me for 3 days; then I will have started shedding virus, and potentially infecting others, for 2 days; today I become symptomatic, self-isolate, and get a test.

Public health only ask me about my contacts for the 48 hours before I developed symptoms. They don’t need to know where I got the virus; that happened 5 days ago. They want to know where the virus is going, who I might have infected, and prevent onward transmission.