switchbladebot / invidget Goto Github PK
View Code? Open in Web Editor NEWSVG invite widgets that look just like the ones on the Discord client!
Home Page: http://invidget.switchblade.xyz/
License: MIT License
SVG invite widgets that look just like the ones on the Discord client!
Home Page: http://invidget.switchblade.xyz/
License: MIT License
I had no issues with this until today when I noticed my link now shows a 404. The invite still works.
https://invidget.switchblade.xyz/nhS4f9PJpg?2
Your domain is offline
I'm thinking about linking ~40 discord invites on my website.
I'm thinking in GitHub actions to run a script before compiling which parses all the invidget URLs hosted on your official instance, and cloning your project and generating the URLs and replacing the links by these svg files
This means I'm using your instance when developping
But when the website is live it's all hosted on my insurance, though it's static and won't update until next change which I'm fine with
what do you think / has this been done before?
It would be cool that if someone added ?format=png
to the end of the URL, the image is automatically converted to a PNG file. I might do a PR later on that if I have time
Edit: This is necessary when sending messages to discord, as discord does not allow embedded SVG for security reasons.
Guess what? yeah, axios on this too
Line 8 in 4a93050
Lines 100 to 105 in 14debfb
TODO
comment in 14debfb. It's been assigned to @pedrofracassi because they committed the code.Servers Down I guess Widgets Not Working
After Japanese support was added in #9, I've noticed that the renderer doesn't handle special characters correctly.
Example: https://invidget.switchblade.xyz/discord-developers?language=ja
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:
{
"id": "<server-id>",
"name": "My Server",
"instant_invite": "https://discordapp.com/invite/<invite-code>",
"channels": [...],
"members": [...],
"presence_count": 3
}
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.
Yeah... we forgot to test it on CI too
In the README.MD light theme preview image is showing 404 error after clicking it.
So can fix it up ๐
Looks like https://invidget.switchblade.xyz/ throws an error, "Cannot GET /".
Throwing 521 error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.