feat: add list command to retrieve and paginate user files
This commit is contained in:
parent
5fd014b677
commit
a5457c6cc6
6 changed files with 153 additions and 17 deletions
12
lib/b64.ts
Normal file
12
lib/b64.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
// i actually love this
|
||||
export const b64encode = (obj: object): string => {
|
||||
return Buffer.from(JSON.stringify(obj)).toString("base64url");
|
||||
}
|
||||
|
||||
export const b64decode = <T>(str: string): T => {
|
||||
try {
|
||||
return JSON.parse(Buffer.from(str, "base64url").toString());
|
||||
} catch {
|
||||
throw new Error("invalid base64-encoded object string: " + str);
|
||||
}
|
||||
}
|
12
lib/embed.ts
Normal file
12
lib/embed.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { EmbedBuilder, User } from "discord.js";
|
||||
|
||||
export const createEmbed = (user: User) => {
|
||||
return new EmbedBuilder()
|
||||
.setColor(0xff264e)
|
||||
.setAuthor({
|
||||
name: `${user.globalName || "user"} on stereo`,
|
||||
iconURL: user.avatarURL({ size: 512 }) || ""
|
||||
})
|
||||
.setFooter({ text: "powered by stereo" })
|
||||
.setTimestamp()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue