You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although using invites directly is usually enough, I thought it'd be cool to also be able to use a server ID instead.
My main concern is that invites are not guaranteed to last long, and to actually generate an invite that doesn't expire, the user has to do some manual configuration of it, and even then, it's easy to accidentally delete an invite without even realizing the things it could have broken.
My suggestion is to allow the server ID to also be used to generate the widget, that way it's more resilient to accidents like deleting an invite or using one that expires.
The setup would be like so:
Go to Server Settings⇒Widget
Enable Server Widget
Set Invite Channel to the desired channel
Once this is done, Discord will automatically generate an invite, and regenerate it once it expires or if it's deleted.
The invite on the top, created by "Information", is the automatically generated one.
To get the current invite by using the server ID, a request can be made to https://discordapp.com/api/guilds/<server-id>/widget.json with the corresponding <server-id>, and the response will look like so:
Should be pretty easy to implement. We can use a regular expression to check if what we have is an ID or not, and then proceed accordingly. Would require a second request to Discord, though.
Although using invites directly is usually enough, I thought it'd be cool to also be able to use a server ID instead.
My main concern is that invites are not guaranteed to last long, and to actually generate an invite that doesn't expire, the user has to do some manual configuration of it, and even then, it's easy to accidentally delete an invite without even realizing the things it could have broken.
My suggestion is to allow the server ID to also be used to generate the widget, that way it's more resilient to accidents like deleting an invite or using one that expires.
The setup would be like so:
Once this is done, Discord will automatically generate an invite, and regenerate it once it expires or if it's deleted.
The invite on the top, created by "Information", is the automatically generated one.
To get the current invite by using the server ID, a request can be made to
https://discordapp.com/api/guilds/<server-id>/widget.json
with the corresponding<server-id>
, and the response will look like so:The key
instant_invite
has the full invite URL, and the invite code is the last portion of the URL.This way, if a server has widgets enabled and an invite channel set, its server ID can be used to get the latest valid invite link.
The text was updated successfully, but these errors were encountered: