Skip to content

Commit

Permalink
feat: remove autoupdate, should be implemented later as a parent process
Browse files Browse the repository at this point in the history
  • Loading branch information
yusshu committed Apr 10, 2023
1 parent 6a70ec8 commit cf75740
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
20 changes: 3 additions & 17 deletions src/http/github/push.listener.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Push } from './github.events';
import { Client, MessageEmbed, TextChannel } from 'discord.js';
import config from '../../../config';
import {autoUpdate} from '../../util/update';

let lastEmbedMessageId: string | undefined = undefined;

Expand Down Expand Up @@ -39,15 +38,8 @@ export default async (client: Client, event: Push) => {
]})).id;
}

function restartIfSelf() {
if (event.repository.full_name === 'unnamed/rose') {
autoUpdate();
}
}

if (!lastEmbedMessageId) {
await sendNewEmbed();
restartIfSelf();
return;
}

Expand All @@ -57,21 +49,15 @@ export default async (client: Client, event: Push) => {

if (lastEmbed.author.name !== title
|| (lastEmbed.description.match(/\n/g) ?? []).length > 7) {
sendNewEmbed()
.then(() => restartIfSelf())
.catch(console.error);
sendNewEmbed().catch(console.error);
} else {
lastEmbedMessage.edit({ embeds: [
new MessageEmbed()
.setColor(config.color)
.setAuthor(title, iconURL, event.repository.url)
.setDescription(lastEmbed.description + '\n' + history)
]})
.then(() => restartIfSelf())
.catch(console.error);
]}).catch(console.error);
}
})
.catch(() => {
sendNewEmbed().then(() => restartIfSelf());
});
.catch(() => sendNewEmbed());
};
21 changes: 0 additions & 21 deletions src/util/update.ts

This file was deleted.

0 comments on commit cf75740

Please sign in to comment.