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

myteams-api

v3.0.0

Published

An MyTeams Module to use discord.js and Twitch API easily

Downloads

22

Readme

MyTeams Helper.

A simple api to use discord.js easily.

Client:

  • The client to login with Discord.js.
  • Parameters: client: Discord.Client, token: String.
/**
 * @example Client example
 **/

const { HelperClient } = require("myteams"); 
const Discord = require("discord.js");
const client = new Discord.Client(); 

new HelperClient(client, "token here"); 

Twitch Helper

  • A twitch helper.
  • Setting up The Client: Parameters:
  • client_id: string //The application client_id.
  • client_secret: string //The application client_secret.

[WARNING] You should be logged in with your application or twitch will reject your request with errors like: Please check your client_id and client_secret.

/**
 * @example Twitch Client example.
**/

const { TwitchHelper } = require('myteams-api');

const twitch = new TwitchHelper({
  client_id: 'Your client id here',
  client_secret: 'Your client secret here'
});
  • Also our twitch helper has a function to get streams.
  • Parameters:
  • channel: string //The channel of twitch.
/**
 * @example Twitch getter streams example
**/

const { TwitchHelper } = require('myteams-api');

const MyTeamsTwitch = new TwitchHelper({
  client_id: 'Your client id here',
  client_secret: 'Your client secret here'
});

async function getStream() {
  const streams = await MyTeamsTwitch.getStreams({ channel: 'Vegetta777' });
  console.log(streams);
}

Command Handling:

  • A CommandHandler with sub-folders.
  • Parameters:
  • path: string //The path of the folder.
  • client: Client //Discord.js client.
  • log: boolean //Log all commands if its true. Default: true.
  • Collection: Discord.Collection //Discord collection for commands.
/**
 * @example Handler Example
 **/

const Discord = require("discord.js");
const path = require("path");
const client = new Discord.Client({ intents: 32767 });
const myteams = require("myteams-api");
client.commands = new Discord.Collection();

myteams.RegisterCommand(
  path.join(__dirname, "./commands"),
  client,
  true,
  client.commands
);

Message Event

  • A message event for our Command Handler.
  • Parameters:
  • client: Client //The discord.js client.
  • prefix: string //The prefix of your bot.
  • Collection: Discord.Collection //The collection of the commands.
/**
 * @example Message Event example 
**/

const Discord = require('discord.js');
const path = require('path')
const client = new Discord.Client({ intents: 32767 });
const myteams = require('myteams-api');
client.commands = new Discord.Collection()

myteams.RegisterCommand(path.join(__dirname, './commands'), client, true, client.commands)
myteams.MessageEvent(client, 'm!', client.commands)

Slash Command Handling

  • A slash command handler.
  • Parameters:
  • client: Client //A Discord.js client.
  • folderName: string //The name of the folder of slash commands.
  • Collection: Discord.Collection //The Collection of the slash handler.
  • guild< Optional >: The guild to deploy the slash, if there its no guild the deploy will be global.
/**
 * @example Slash Command Handling
 **/
const Discord = require("discord.js");
const client = new Discord.Client({ intents: 32767 });
const myteams = require("myteams-api");
client.commands = new Discord.Collection();
client.slashCommands = new Discord.Collection();

myteams.RegisterSlash(
  client,
  "SlashCommands",
  client.slashCommands,
  "Guild id (optional) if doesnt have guild the deploy its glolal"
);

Interaction Event

  • A interaction event for our Slash Handler.
  • Parameters:
  • client: Client //Discord.js Client
  • collection: Discord.Collection //The collection of slash commands.
/**
 * @example interactionCreate event
 **/

const Discord = require('discord.js');
const path = require('path')
const client = new Discord.Client({ intents: 32767 });
const myteams = require('myteams-api');
client.slashCommands = new Discord.Collection()

myteams.RegisterSlash(client, 'SlashCommands', client.slashCommands, '840075643286716429')
myteams.InteractionEvent(client, client.slashCommands);