Discord: Difference between revisions

From Redemption Wiki
Jump to navigation Jump to search
>Amonn11
No edit summary
>Amonn11
No edit summary
Line 1: Line 1:
{{Languages}}
{{Infobox JavaScript
| Description = Allows embedding Discord server widgets into content and sidebar
| Scope      = Site-wide<br />Personal
| Author      = [[User:KockaAdmiralac|KockaAdmiralac]]
| Updated    = 01/08/16 (DD/MM/YY)
| Code        = [[MediaWiki:DiscordIntegrator/code.js|code.js]]
| Skins      = omb
| Languages  = {{l|en}}
| Status      = stable
}}
'''DiscordIntegrator''' allows integrating a [https://discordapp.com/ Discord] widget into your sidebar or content. The [https://blog.discordapp.com/add-the-discord-widget-to-your-site Discord widget] is able to show all online users in a server, the users game activity, anyone in a voice channel and etc.
'''If, after reading the documentation, you still don't understand how to set DiscordIntegrator up, read [[/instructions|the step-by-step manual]].'''
== Installation ==
To install this script, you need to have [[Help:Community CSS and JS#JavaScript|JavaScript]] enabled on the wiki. If you don't, you will need to contact FANDOM staff to enable it for you. You can do so by using [[Special:Contact/general|this contact form]] to request [[Help:Staff|FANDOM Staff]] to enable it.
After your JavaScript is enabled by FANDOM staff, go to your wiki's [[MediaWiki:ImportJS]] page. If you don't know where your wiki's ImportJS page is, just copy this link <code>http://dev.wikia.com/wiki/MediaWiki:ImportJS</code> and replace "dev" with the name of your wiki. For example, if your wiki is the [[w:c:disney|Disney Wiki]] you would go to <code>http://disney.wikia.com/wiki/MediaWiki:ImportJS</code>.
Once you have arrived at your wiki's ImportJS page, click the "Edit" button and insert:
dev:DiscordIntegrator/code.js
into the page.
'''Note:''' DiscordIntegrator configuration and importing '''does not require any [[Help:JavaScript review process|JavaScript review]] in order to function normally.'''
== Configuration ==
=== Enabling the widget ===
The widget can be enabled by Discord server administrators by going through the settings screen of their Discord server and going to the "Widget" settings section. To enable embedding a widget to your server, tick the "Enable Widget" box. If you wish for users to be able to connect to your server through the widget, you should also select a chat room in the "Instant invite channel" option.
<gallery position="center" widths="300" captionalign="center" hideaddbutton="true">
  DiscordIntegrator-1.png | You can find the Server Settings when clicking on your server title
  DiscordIntegrator-2.png | Once you're in Server Settings, enter the "Widget" section
  DiscordIntegrator-3.png | In the Widget section, you will see the option to enable the server widget (in <span style="color: red;">red</span>), the instant invite channel option (in <span style="color: yellow;">yellow</span>) and your server ID (in <span style="color: green;">green</span>)
  DiscordIntegrator-4.png | You might want to set that section to something like this
</gallery>
'''Important''': The server ID that can be found in the widget settings section is very important for setting up the widget, which is explained in sections below and in the template.
=== Content ===
After the script is installed through the methods explained [[#Installation|above]], it is possible to make the widget show up in the page content. It is advised to create a template on your wiki and copy the contents of {{t|DiscordIntegrator}} to it. After that, the template can be used as:
<pre>
{{DiscordIntegrator
{{DiscordIntegrator
| id = 246075715714416641
| theme = light
| width = 500px
| height = 500px
}}
</pre>
which gives: <br />
<div style="text-align: center; margin: auto">{{DiscordIntegrator
|id = 246075715714416641
|id = 246075715714416641
|theme = light
|theme = light
|width = 500px
|width = 500px
|height = 500px
|height = 500px
}}
}}</div>
'''Note:''' DiscordIntegrator does not work on the mobile skin, which will display an error message instead of the Discord widget. To prevent the widget from displaying on the mobile skin, you can set the [[Help:Template types|template type]] of the widget to a template type that doesn't display on mobile (such as Navbox).
 
For more complicated usage you can check the [[Template:DiscordIntegrator|DiscordIntegrator template documentation]] itself.
 
=== Sidebar ===
The script can be configured to add the widget to the sidebar of the wiki on [[Help:Layout|Oasis]] skin through editing several MediaWiki pages. Any MediaWiki page relating to the configuration of DiscordIntegrator starts with <code>MediaWiki:Custom-DiscordIntegrator-config-</code> and after it goes the name of the configuration option. For example, to configure the ID of the server, you'd need to go to <code>[[MediaWiki:Custom-DiscordIntegrator-config-id|MediaWiki:Custom-DiscordIntegrator-config-id]]</code>.
 
The widget will appear in the siderail, ''only'' if the ID of the server is set in configuration options. Configuration options have same names as configuration options when adding the widget to content, except with the addition of a few parameters:
{| class="wikitable" style="width: 100%; text-align: center;"
! Option
! Type
! What it changes
! Default
|-
! <tt>title</tt>
| String
| Title of the module on the siderail
| None
|-
! <tt>moduleHeight</tt>
| String
| Height of the module in the siderail
| 500px
|-
! <tt>text</tt>
| String
| Text above the widget
| None
|}
An example of the widget can be seen in the sidebar on this page.
 
== Frequently Asked Questions ==
; Can I change the colors on the widget?
: Currently, no. The widget is an [https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe iframe,] therefore its style cannot be changed.
; The widget is loading infinitely
: That means you didn't enable the widget in your server settings.
: Enable the widget as said in [[#Enabling the widget|Enabling the widget]] section and refresh the page.
: Sometimes it might take a minute or two for the widget to register it's enabled.
; Is the ID required for the module to function?
: Yes, or nothing will display

Revision as of 04:41, 1 November 2017

Template:Languages Template:Infobox JavaScript DiscordIntegrator allows integrating a Discord widget into your sidebar or content. The Discord widget is able to show all online users in a server, the users game activity, anyone in a voice channel and etc.

If, after reading the documentation, you still don't understand how to set DiscordIntegrator up, read the step-by-step manual.

Installation

To install this script, you need to have JavaScript enabled on the wiki. If you don't, you will need to contact FANDOM staff to enable it for you. You can do so by using this contact form to request FANDOM Staff to enable it.

After your JavaScript is enabled by FANDOM staff, go to your wiki's MediaWiki:ImportJS page. If you don't know where your wiki's ImportJS page is, just copy this link http://dev.wikia.com/wiki/MediaWiki:ImportJS and replace "dev" with the name of your wiki. For example, if your wiki is the Disney Wiki you would go to http://disney.wikia.com/wiki/MediaWiki:ImportJS.

Once you have arrived at your wiki's ImportJS page, click the "Edit" button and insert:

dev:DiscordIntegrator/code.js

into the page.

Note: DiscordIntegrator configuration and importing does not require any JavaScript review in order to function normally.

Configuration

Enabling the widget

The widget can be enabled by Discord server administrators by going through the settings screen of their Discord server and going to the "Widget" settings section. To enable embedding a widget to your server, tick the "Enable Widget" box. If you wish for users to be able to connect to your server through the widget, you should also select a chat room in the "Instant invite channel" option.

Important: The server ID that can be found in the widget settings section is very important for setting up the widget, which is explained in sections below and in the template.

Content

After the script is installed through the methods explained above, it is possible to make the widget show up in the page content. It is advised to create a template on your wiki and copy the contents of {{DiscordIntegrator}} to it. After that, the template can be used as:

{{DiscordIntegrator
| id = 246075715714416641
| theme = light
| width = 500px
| height = 500px
}}

which gives:

If you see this, your JavaScript might be disabled or DiscordIntegrator plugin isn't working. If the latter, please contact a wiki administrator.

Note: DiscordIntegrator does not work on the mobile skin, which will display an error message instead of the Discord widget. To prevent the widget from displaying on the mobile skin, you can set the template type of the widget to a template type that doesn't display on mobile (such as Navbox).

For more complicated usage you can check the DiscordIntegrator template documentation itself.

Sidebar

The script can be configured to add the widget to the sidebar of the wiki on Oasis skin through editing several MediaWiki pages. Any MediaWiki page relating to the configuration of DiscordIntegrator starts with MediaWiki:Custom-DiscordIntegrator-config- and after it goes the name of the configuration option. For example, to configure the ID of the server, you'd need to go to MediaWiki:Custom-DiscordIntegrator-config-id.

The widget will appear in the siderail, only if the ID of the server is set in configuration options. Configuration options have same names as configuration options when adding the widget to content, except with the addition of a few parameters:

Option Type What it changes Default
title String Title of the module on the siderail None
moduleHeight String Height of the module in the siderail 500px
text String Text above the widget None

An example of the widget can be seen in the sidebar on this page.

Frequently Asked Questions

Can I change the colors on the widget?
Currently, no. The widget is an iframe, therefore its style cannot be changed.
The widget is loading infinitely
That means you didn't enable the widget in your server settings.
Enable the widget as said in Enabling the widget section and refresh the page.
Sometimes it might take a minute or two for the widget to register it's enabled.
Is the ID required for the module to function?
Yes, or nothing will display