Package Exports
- animated-welcome
- animated-welcome/src/generateWelcomeGif.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (animated-welcome) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Animated Welcome
animated-welcome
is an npm package that generates animated welcome GIFs for Discord bots. It uses canvas
, gif-encoder-2
, and sharp
to create high-quality GIFs.
Installation
Install the package using npm:
npm install animated-welcome
Usage
Here is an example of how to use the package in a Discord bot:
import { generateWelcomeGif } from 'animated-welcome';
// Example usage in a Discord bot event
client.on('guildMemberAdd', async (member) => {
const welcomeMessage = 'Welcome {user} to {server}!';
const backgroundURL = 'https://example.com/background.gif';
try {
const gifBuffer = await generateWelcomeGif(member.user, member.guild, welcomeMessage, backgroundURL);
// Send the GIF as an attachment
const attachment = new MessageAttachment(gifBuffer, 'welcome.gif');
const channel = member.guild.systemChannel;
if (channel) {
channel.send({ content: `Welcome ${member.user.username}!`, files: [attachment] });
}
} catch (error) {
console.error('Failed to generate welcome GIF:', error);
}
});
Parameters
user
: A Discord.jsUser
orGuildMember
object.guild
: A Discord.jsGuild
object.messageTemplate
: A string template for the welcome message. Use{user}
and{server}
as placeholders.backgroundURL
: (Optional) A URL to a background GIF. Defaults to a galaxy-themed GIF.
License
This project is licensed under the MIT License.