Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

sveenxx/discord-widget

Repository files navigation

Easly add custom discord widgets to your website.

License: MIT

Installation

Via NPM:

$ npm install discord-widget --save

Via Yarn (recommended):

$ yarn add discord-widget

Setup

import Widget from "discord-widget";

(async function () {
    await Widget.init(
        document.querySelector("#my-widget-container"),
        "server-id"
    );
})();

if you are not using any bundlers

<script src="dist/discord-widget.js"></script>

<script>
    (async function () {
        await DiscordWidget.init(
            document.querySelector("#my-widget-container"),
            "server-id"
        );
    })();
</script>

Example

import Widget from "discord-widget";

const container = document.querySelector("#my-widget-container")

(async function () {
    await Widget.init(container, "600381707073486871");

    //Use it if you want to disable default styles and use your own
    Widget.detachStyle();
})()

Contact

License

Copyright © 2021 Jakub Szołtysek.
This project is MIT licensed.