mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix: Make emoji importing warn you if the emoji already exists earlier
This commit is contained in:
parent
38e390c418
commit
ab74c17ebd
34
cli.ts
34
cli.ts
|
|
@ -921,23 +921,6 @@ switch (command) {
|
|||
let emojisCreated = 0;
|
||||
|
||||
for (const [name, path] of Object.entries(pack_response)) {
|
||||
// Get emoji URL, as it can be relative
|
||||
|
||||
const emoji = Bun.file(`${tempDirectory}/${path}`);
|
||||
|
||||
const content_type = emoji.type;
|
||||
|
||||
const hash = await uploadFile(emoji as File, config);
|
||||
|
||||
if (!hash) {
|
||||
console.log(
|
||||
`${chalk.red(`✗`)} Failed to upload emoji ${name}`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const finalUrl = getUrl(hash, config);
|
||||
|
||||
// Check if emoji already exists
|
||||
const existingEmoji = await client.emoji.findFirst({
|
||||
where: {
|
||||
|
|
@ -955,6 +938,23 @@ switch (command) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Get emoji URL, as it can be relative
|
||||
|
||||
const emoji = Bun.file(`${tempDirectory}/${path}`);
|
||||
|
||||
const content_type = emoji.type;
|
||||
|
||||
const hash = await uploadFile(emoji as File, config);
|
||||
|
||||
if (!hash) {
|
||||
console.log(
|
||||
`${chalk.red(`✗`)} Failed to upload emoji ${name}`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const finalUrl = getUrl(hash, config);
|
||||
|
||||
// Create emoji
|
||||
await client.emoji.create({
|
||||
data: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue