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

migme-seagull

v4.0.1

Published

Migme Chat

Downloads

12

Readme

Seagull

Migme chat for javascript

NPM Version Dependency Status devDependency Status Build Status Code Quality Code Coverage

Usage

Installation

Install Node.js

Run npm install

Testing

Run npm test

Using

import Ferry from 'migme-ferry'
import Chat, {Individual, ChatRoom, GroupChat, ChatEvent} from 'migme-seagull'

// Initialise ferry first and wait for connected

// Chat container
const chat = new Chat(ferry)

// Individual chat
const individual = new Individual('exampleaccount', ferry)

// ChatRoom
const chatroom = new ChatRoom(ferry)
chatroom.join('A Chat ChatRoom')

// GroupChat
const groupchat = new GroupChat(ferry)
groupchat.join('XXXXXXXXXXXXXXXXX')

Chat

Get chats

chat.list()
  .then(res => {
    // Got a list of chats
  })
  .catch(err => {
    // there was a problem
  })

Get contacts

chat.contacts()
  .then(res => {
    // Got an array of packets of contact groups and contacts
  })
  .catch(err => {
    // there was a problem
  })

The following methods work with Individual, ChatRoom and GroupChat

Send a message

individual.send('Hello World')

Send a sticker

individual.sendSticker('HSthumbsup')

Send a gift

individual.sendGift('Hi')

Send a gift with a message

individual.sendGift('Hi', 'Here is a gift for you')

Send an image

individual.sendMedia('http://example.com/image.jpg')

Send an image with a message or meta data

individual.sendMedia('http://example.com/image.gif', {
  message: 'I found this image for you',
  mime_type: 'image/gif'
})

Both message and mime_type are optional

Get Emoticon

individual.getEmoticon(['(m_GBbleed)'])

ChatRoom

Create a new chatroom

To create a new chatroom the user needs to be mig level 10 or higher. The chat room name must not contain more than 15 characters

const chatroom = new ChatRoom(ferry)
chatroom
  .create('My Fancy ChatRoom')
  .then(res => {
    // ChatRoom created
  })
  .catch(err => {
    // There was an error
  })

Create chatroom with additional options

All options are optional

const chatroom = new ChatRoom(ferry)
chatroom
  .create('My Fancy ChatRoom', {
    description: '', // string description of chatroom
    keywords: '', // Separated by commas
    language: '', // Three (3) character language code (ISO 639-2)
    allow_kicking: false
  })

Join a chatroom

const chatroom = new ChatRoom(ferry)
chatroom
  .join('My Fancy ChatRoom')
  .then(res => {
    // Joined the room
  })
  .catch(err => {
    // there was a problem
  })

Favorite a chatroom

chatroom.favorite()
  .then(res => {
    // Favorited the room
  })
  .catch(err => {
    // there was a problem
  })

Unfavorite a chatroom

chatroom.unfavorite()
  .then(res => {
    // Favorited the room
  })
  .catch(err => {
    // there was a problem
  })

Get participants

chatroom.participants()
  .then(res => {
    // got the participants
  })
  .catch(err => {
    // there was a problem
  })

Kick a user

chatroom.kick('username')
  .then(res => {
    // User kicked
  })
  .catch(err => {
    // there was a problem
  })

Mute a user

chatroom.mute('username')
  .then(res => {
    // User muted
  })
  .catch(err => {
    // there was a problem
  })

Unmute a user

chatroom.unmute('username')
  .then(res => {
    // User unmuted
  })
  .catch(err => {
    // there was a problem
  })

Leave the chatroom

chatroom.leave()
  .then(res => {
    // Left the chatroom
  })
  .catch(err => {
    // there was a problem
  })

Send a gift

This works the same as in regular chat, however you can pass an extra parameter to specify the destination. By default the destination will be all, which will send to all members of the chatroom.

chatroom.sendGift('Hi', 'Here is a gift for you', 'all')

Chat GroupChat

###Create a chat group

const groupchat = new GroupChat(ferry)
groupchat
  .create(['exampleuser', 'anotheruser'])
  .then(res => {
    // GroupChat created
  })
  .catch(err => {
    // There was an error
  })

Join a chat group

const groupchat = new GroupChat(ferry)
groupchat
  .join('XXXXXXXXXXXXXXXXX')
  .then(res => {
    // Joined the group
  })
  .catch(err => {
    // there was a problem
  })

Get participants

groupchat.participants()
  .then(res => {
    // got the participants
  })
  .catch(err => {
    // there was a problem
  })

Invite a user to the group chat

groupchat.invite('exampleuser')
// or
groupchat.invite(['exampleuser', 'anotheruser'])
  .then(res => {
    // got the user status
  })
  .catch(err => {
    // there was a problem
  })

Send a gift

This works the same as in regular chat, however you can pass an extra parameter to specify the destination. By default the destination will be all, which will send to all members of the group chat.

groupchat.sendGift('Hi', 'Here is a gift for you', 'all')

Leave the chat group

groupchat.leave()
  .then(res => {
    // Left the chat group
  })
  .catch(err => {
    // there was a problem
  })

Chat List

const chatlist = new ChatList(ferry)

Get chat list

chatlist.list()
  .then(res => {
    // Got the chat list
  })
  .catch(err => {
    // there was a problem
  })

Chat Room List

const roomlist = new ChatRoomList(ferry)

Get chat room list

roomlist.list()
  .then(res => {
    // Got the chat room list
  })
  .catch(err => {
    // there was a problem
  })

Get chatroom categories

roomlist.categories()
  .then(res => {
    // Got the chat room categories
  })
  .catch(err => {
    // there was a problem
  })

Contacts

const contacts = new Contacts(ferry)

Get Contact list

contacts.list()
  .then(res => {
    // Got the list of contacts
  })
  .catch(err => {
    // there was a problem
  })

Add contact group

contacts.addGroup('Group Name')
  .then(res => {
    // Contact group added
  })
  .catch(err => {
    // there was a problem
  })

Update contact group

contacts.updateGroup(group_id, 'New Group Name')
  .then(res => {
    // Contact group updated
  })
  .catch(err => {
    // there was a problem
  })

Remove contact group

contacts.removeGroup(group_id)
  .then(res => {
    // Contact group removed
  })
  .catch(err => {
    // there was a problem
  })

Move contact to a different group

contacts.move(contact_id, group_id)
  .then(res => {
    // Contact moved
  })
  .catch(err => {
    // there was a problem
  })