npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fdgt/api

v1.0.2

Published

[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=trezy-studios/fdgt)](https://dependabot.com) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> [![All Contributors](https://img.shields.io/badge/all

Downloads

8

Readme

fdgt

Dependabot Status

All Contributors

fdgt is a mock API for the Twitch Messaging Interface (tmi). Via fdgt, you can connect and test your Twitch bots and other tools with simulated events without having to connect to the real API!

How does it work?

Using fdgt is pretty simple. Instead of pointing to the irc-ws.chat.twitch.tv, you point to to tmi.fdgt.dev. DONE.

Wait seriously?

Yup.

It can't be that simple!

It is, tho. Check out this example with tmi.js.

Connecting to the real tmi

const tmi = require('tmi.js')
const client = new tmi.Client()

client.connect()

Connecting to the fdgt mock tmi

const tmi = require('tmi.js')
const client = new tmi.Client({
	connection: { server: 'tmi.fdgt.dev' },
})

client.connect()

Simulating events

One of the hardest parts of working with the Twitch chat API is that to test your tool with different payloads, you have to perform the real action that would trigger that event.

Need to trigger a message with bits? You're going to be cheering a lot.

Need to simulate a subscription? I hope you've got deep pockets.

Need to simulate a submysterygift with 10 Tier 3 subscriptions? God help you.

Instead of blowing the wads of cash that you probably don't have, use fdgt! With fdgt, you just have to send the right message to the chat service, and it'll trigger the appropriate event! Here's an example of triggering a message with bits in it, again using tmi.js:

client.say('#TrezyCodes', 'bits')

And just like that, fdgt will fire a simulated message with bits attached!

Getting a specific response

Sometimes, the randomized events that fdgt generates just aren't specific enough. Fortunately, fdgt's interface is controlled just like a CLI! If you want to change the username of the person that "triggered" the event, you can pass it with the --username flag!

client.say('#TrezyCodes', 'bits --username alca')

...or, say you want to simulate that 10x Tier 3 submysterygift we mentioned earlier:

client.say('#TrezyCodes', 'submysterygift.tier3 --username alca --giftcount 10')

For more information on what events are available and what parameters they support, check out the events section.

Help & Support

Need some help using fdgt? No problem! Hop on to the Trezy Studios Discord and we'll be happy to help! ❤️

API

Events

Globally supported parameters

The following table describes the parameters that are supported by almost every message. There are exceptions (namely the mode triggers, like emoteonly, slowmode, and subsonly), noted under the respective events.

| Parameter | Description | Default Value | | ----------- | --------------------------------------------------------------- | --------------------------------------- | | channel | The name of the channel (no #) | the channel that the event was sent to | | channelid | The ID of the channel | randomly UUID | | color | The user's display color | randomly generated hex color | | messageid | The ID of the message | randomly UUID | | timestamp | The timestamp (in milliseconds) of the message | the current timestamp | | userid | The ID of the user sending the message or triggering the event | randomly UUID | | username | The username of the user that triggered the event | randomly generated by faker | | host | The host of the Twitch server | tmi.twitch.tv |

bits

This event is normally triggered when a user does X.

Supported parameters

| Parameter | Description | Default Value | | ----------- | ------------------------------------------- | --------------------------------------------- | | bitscount | the total number of bits that were cheered | 100 | | message | the message body that was sent | the message body, i.e. bits --bitscount 50 |

Examples
client.say('#csharpfritz', 'bits --bitscount 50')

emoteonly.off

This event is normally triggered when the room is set to emote-only mode, then emote-only mode is turned off.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#chaelcodes', 'emoteonly.off --channel timbeaudet')

emoteonly.on

This event is normally triggered when the room is set to emote-only mode.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#stuyksoft', 'emoteonly.on --channel tutorexilius')

extendsub.tier1

This event is normally triggered when a user extends their Tier 1 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months that the subscription is being extended | 3 |

Examples
client.say('#howtocodewell', 'extendsub.tier1 --months 6')

fdgt will automatically calculate and name the correct month, so if you want the month in the message to be in the future (or the past!), make sure to set the timestamp. To represent an extension from January 2015 to June 2015, you could do the following:

client.say('#chefbrent', 'extendsub.tier1 --months 6 --timestamp 1420092000000')

extendsub.tier2

This event is normally triggered when a user extends their Tier 2 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months that the subscription is being extended | 3 |

Examples
client.say('#jeffblankenburg', 'extendsub.tier2 --months 6')

fdgt will automatically calculate and name the correct month, so if you want the month in the message to be in the future (or the past!), make sure to set the timestamp. To represent an extension from January 2015 to June 2015, you could do the following:

client.say('#latteandmia', 'extendsub.tier2 --months 6 --timestamp 1420092000000')

extendsub.tier3

This event is normally triggered when a user extends their Tier 3 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months that the subscription is being extended | 3 |

Examples
client.say('#mbcrump', 'extendsub.tier3 --months 6')

fdgt will automatically calculate and name the correct month, so if you want the month in the message to be in the future (or the past!), make sure to set the timestamp. To represent an extension from January 2015 to June 2015, you could do the following:

client.say('#itslittany', 'extendsub.tier3 --months 6 --timestamp 1420092000000')

giftpaidupgrade

This event is normally triggered when a user upgrades from a gifted subscription.

Supported parameters

| Parameter | Description | Default Value | | ----------- | ----------------------------------------------------------------------- | ----------------------------------------------- | | username2 | the username of the user that last gifted a sub to the triggering user | a random username generated by faker |

Examples
client.say('#themessycoder', 'giftpaidupgrade --username2 MrDemonWolf')

primepaidupgrade.tier1

This event is normally triggered when a user upgrades from a Prime subscription to a Tier 1 subscription.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#shadesofpixie', 'primepaidupgrade.tier1')

primepaidupgrade.tier2

This event is normally triggered when a user upgrades from a Prime subscription to a Tier 2 subscription.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#edcharbeneau', 'primepaidupgrade.tier2')

primepaidupgrade.tier3

This event is normally triggered when a user upgrades from a Prime subscription to a Tier 3 subscription.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#ramblinggeek', 'primepaidupgrade.tier3')

raid

This event is normally triggered when a channel is raided by another stream.

Supported parameters

| Parameter | Description | Default Value | | ------------- | ------------------------------------------- | ------------- | | viewerCount | the number of viewers that joined the raid | 10 |

Examples
client.say('#narebabr', 'raid --viewerCount 100')

resubscription.prime

This event is normally triggered when a user continues their Prime subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months for which the user has been a subscriber | 3 |

Examples
client.say('#developersgarage', 'resubscription.prime --months 6')

resubscription.tier1

This event is normally triggered when a user continues their Tier 1 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months for which the user has been a subscriber | 3 |

Examples
client.say('#relevantjesse', 'resubscription.tier1 --months 6')

resubscription.tier2

This event is normally triggered when a user continues their Tier 2 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months for which the user has been a subscriber | 3 |

Examples
client.say('#roberttables', 'resubscription.tier2 --months 6')

resubscription.tier3

This event is normally triggered when a user continues their Tier 3 subscription.

Supported parameters

| Parameter | Description | Default Value | | --------- | ------------------------------------------------------------- | ------------- | | months | the number of months for which the user has been a subscriber | 3 |

Examples
client.say('#timvanmonero', 'resubscription.tier3 --months 6')

slowmode.off

This event is normally triggered when the room is set to slow mode, then slow mode is turned off.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#rosuav', 'slowmode.off --channel fiercekittenz')

slowmode.on

This event is normally triggered when the room is set to slow mode.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#lannonbr', 'slowmode.on --channel sudokid')

subgift.tier1

This event is normally triggered when a user gifts a Tier 1 subscription to another user in the channel.

Supported parameters

| Parameter | Description | Default Value | | ----------- | ----------------------------------------------------------------- | ----------------------------------------------- | | userid2 | the username of the user that is receiving the subscription gift | a random username generated by faker | | username2 | the id of the user that is receiving the subscription gift | a random UUID |

Examples
client.say('#chiefcll', 'subgift.tier1 --username2 jitterted')

subgift.tier2

This event is normally triggered when a user gifts a Tier 2 subscription to another user in the channel.

Supported parameters

| Parameter | Description | Default Value | | ----------- | ----------------------------------------------------------------- | ----------------------------------------------- | | userid2 | the username of the user that is receiving the subscription gift | a random username generated by faker | | username2 | the id of the user that is receiving the subscription gift | a random UUID |

Examples
client.say('#davidortinau', 'subgift.tier2 --username2 syropian')

subgift.tier3

This event is normally triggered when a user gifts a Tier 3 subscription to another user in the channel.

Supported parameters

| Parameter | Description | Default Value | | ----------- | ----------------------------------------------------------------- | ----------------------------------------------- | | userid2 | the username of the user that is receiving the subscription gift | a random username generated by faker | | username2 | the id of the user that is receiving the subscription gift | a random UUID |

Examples
client.say('#cldubya', 'subgift.tier3 --username2 drmikachu')

submysterygift.tier1

This event is normally triggered when a user gives Tier 1 mystery subscription gifts.

Supported parameters

| Parameter | Description | Default Value | | ----------------- | --------------------------------------------------------------- | ------------- | | giftcount | the number of gifts the user is currently giving in the channel | 5 | | totalgiftcount | the total number of gifts the user has given in the channel | giftcount |

Examples
client.say('#jumpystick', 'submysterygift.tier1 --giftcount 10')

submysterygift.tier2

This event is normally triggered when a user gives Tier 2 mystery subscription gifts.

Supported parameters

| Parameter | Description | Default Value | | ----------------- | --------------------------------------------------------------- | ------------- | | giftcount | the number of gifts the user is currently giving in the channel | 5 | | totalgiftcount | the total number of gifts the user has given in the channel | giftcount |

Examples
client.say('#lizelive', 'submysterygift.tier2 --giftcount 10')

submysterygift.tier3

This event is normally triggered when a user gives Tier 3 mystery subscription gifts.

Supported parameters

| Parameter | Description | Default Value | | ----------------- | --------------------------------------------------------------- | ------------- | | giftcount | the number of gifts the user is currently giving in the channel | 5 | | totalgiftcount | the total number of gifts the user has given in the channel | giftcount |

Examples
client.say('#fullstacklive', 'submysterygift.tier3 --giftcount 10')

subscription.prime

This event is normally triggered when a user subscribes to a channel for the first time with Prime.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#talk2megooseman', 'subscription.prime --channel funfunfunction')

subscription.tier1

This event is normally triggered when a user purchases a Tier 1 subscription to a channel for the first time.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#lana_lux', 'subscription.tier1 --channel jamesmontemagno')

subscription.tier2

This event is normally triggered when a user purchases a Tier 2 subscription to a channel for the first time.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#coderushed', 'subscription.tier2 --channel codingbandit')

subscription.tier3

This event is normally triggered when a user purchases a Tier 3 subscription to a channel for the first time.

Supported parameters

This event only supports the global parameters.

Examples
client.say('#clarkio', 'subscription.tier3 --channel kasuken')

subsonly.off

This event is normally triggered when the room is set to subscribers-only mode, then subscribers-only mode is turned off.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#alca', 'subsonly.off --channel atomikjaye')

subsonly.on

This event is normally triggered when the room is set to subscribers-only mode.

Supported parameters

This event does not support all global parameters. The table below is an exhaustive list of the supported parameters for this event.

| Parameter | Description | Default Value | | ----------- | --------------------------------- | ----------------------------------- | | channel | the name of the channel (no #) | a random channel that you've joined | | host | the host of the Twitch server | tmi.twitch.tv |

Examples
client.say('#devchatter', 'subsonly.on --channel brandonsatrom')

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!