option to change speed
This commit is contained in:
parent
6088de8682
commit
03635e748b
1 changed files with 5 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ export default class PingCommand extends Command {
|
||||||
|
|
||||||
async run(interaction: ChatInputCommandInteraction, config: Config) {
|
async run(interaction: ChatInputCommandInteraction, config: Config) {
|
||||||
const user = interaction.options.getUser('user', true)
|
const user = interaction.options.getUser('user', true)
|
||||||
|
const speed = interaction.options.getInteger('speed') ?? 0
|
||||||
const avatarResponse = await fetch(user.avatarURL({})!)
|
const avatarResponse = await fetch(user.avatarURL({})!)
|
||||||
const avatarBuf = Buffer.from(await avatarResponse.arrayBuffer())
|
const avatarBuf = Buffer.from(await avatarResponse.arrayBuffer())
|
||||||
const frames: SharpInput[] = []
|
const frames: SharpInput[] = []
|
||||||
|
|
@ -46,7 +47,7 @@ export default class PingCommand extends Command {
|
||||||
const webP = await sharp(
|
const webP = await sharp(
|
||||||
frames,
|
frames,
|
||||||
{ join: { animated: true } }
|
{ join: { animated: true } }
|
||||||
).webp({ delay: new Array(pos).fill(200), loop: 0 }).toBuffer();
|
).webp({ delay: new Array(pos).fill(200-speed), loop: 0 }).toBuffer();
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `Patting ${user.displayName}`,
|
content: `Patting ${user.displayName}`,
|
||||||
files: [
|
files: [
|
||||||
|
|
@ -65,6 +66,9 @@ export default class PingCommand extends Command {
|
||||||
.addUserOption(builder => builder.setName("user")
|
.addUserOption(builder => builder.setName("user")
|
||||||
.setDescription("The one to plap")
|
.setDescription("The one to plap")
|
||||||
.setRequired(true))
|
.setRequired(true))
|
||||||
|
.addIntegerOption(builder => builder.setName("speed")
|
||||||
|
.setDescription("speed (higher is faster, max is 200)")
|
||||||
|
.setRequired(false))
|
||||||
.setContexts([
|
.setContexts([
|
||||||
InteractionContextType.BotDM,
|
InteractionContextType.BotDM,
|
||||||
InteractionContextType.Guild,
|
InteractionContextType.Guild,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue