Skip to content

widgetbot-io/crate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

298 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crate

npm version Docs JSDelivr

Clean & powerful popup Discord widgets for your website.

Demo

Usage

See the documentation for more options.

<script src="https://cdn.jsdelivr.net/npm/@widgetbot/crate@3" async>
  const crate = new Crate({
    server: '299881420891881473',
    channel: '355719584830980096'
  })

  crate.notify('Test notification')
  crate.on('signIn', data => {
    console.log(`Guest signed in as ${data.name}`)
    crate.emit('sendMessage', 'Hello world')
  })
</script>

Telegram

Pass chat (instead of server / channel) and the shard URL of your deployed Telegram widget host:

<script src="https://cdn.jsdelivr.net/npm/@widgetbot/crate@3" async>
  const crate = new Crate({
    chat: '-1003784217881',
    shard: 'https://your-telegram-widget.example.com',
    // topic: '12', // supergroup topic, optional
  })

  crate.on('ready', () => console.log('telegram-widget ready'))
  crate.on('signIn', user => console.log('signed in as', user))
</script>

When chat is set, crate switches into Telegram mode: navigation events use chatId/topicId and the default button color is Telegram blue. shard is required in Telegram mode — there is no default host.

About

Popup Discord widgets for your website ☄️

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors