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;
|
let emojisCreated = 0;
|
||||||
|
|
||||||
for (const [name, path] of Object.entries(pack_response)) {
|
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
|
// Check if emoji already exists
|
||||||
const existingEmoji = await client.emoji.findFirst({
|
const existingEmoji = await client.emoji.findFirst({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -955,6 +938,23 @@ switch (command) {
|
||||||
continue;
|
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
|
// Create emoji
|
||||||
await client.emoji.create({
|
await client.emoji.create({
|
||||||
data: {
|
data: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue