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

clashofmagic.js

v1.1.1

Published

The wrapper in typescript for Clash of Magic API

Downloads

4

Readme

ClashofMagic.JS

clashofmagic.js it's a wrapper for the Clash of Magic API made in TypeScript and will simplify the tasks to get data from the API

Note: It's required v14 of node or a newer version

Changelog

v1.0.0
= Added the package

v1.1.0
+ Added client events

v1.1.1
+ Added clanWarStart event

Setup

const { Client } = require('clashofmagic.js')
const client = new Client('SERVER')

/**
 * Available options for SERVER:
 * - s1
 * - s2
 */

Request Player Information

async function player(tag) {
	const player = await client.getPlayer(tag)

	console.log(player)
}

player('#2PP')

// This will return all the information of the player

Methods

  • .clan() - Returns information about player's clan if the player is in a clan
    • .war() - Returns information about player's clan war if the player is in a clan
  • .verifyToken(APIToken: string) - Verifies the API Token of the player

Request Clan Information

async function clan(tag) {
	const clan = await client.getClan(tag)

	console.log(clan)
}

clan('#2PP')

// This will return all the information of the clan

Methods

  • .war() - Returns information about the clan war if the clan started one

Get Clan War Information

async function clanWar(tag) {
	const clanWar = await client.getClanWar(tag)

	console.log(clanWar)
}

clanWar('#2PP')

// This will return all the information of the clan war if the clan started one

Verify a player's API Token

async function verifyToken(tag, APIToken) {
	const verifyToken = await client.verifyToken(tag, APIToken)

	console.log(verifyToken)
}

verifyToken('#2PP', 'API-TOKEN-HERE')

/* If the token is valid will send this output in console:
{ status: "valid" }
*/

Client Events

client.events.addPlayer('#2PP')

client.on('playerNameUpdate', (oldName, newName) => {
	console.log(oldName.name + ' - ' + newName.name)
})

client.events.init()

// This will return the old and new name of the player when he change it

Available Events:

  • name: clanMemberAdd, listener: newMember
  • name: clanMemberRemove, listener: oldMember
  • name: playerNameUpdate, listeners: oldName, newName
  • name: playerLeagueUpdate, listener: newLeague
  • name: clanWarStart, listener: war

Disclaimer

This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell's Fan Content Policy.

LICENSE

ISC License

Copyright (c) 2022 Jelosus1

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.