Skip to content

Commit

Permalink
Update dependencies (#1750)
Browse files Browse the repository at this point in the history
* Update dependencies

* Update .prettierrc.json

* Prettier fixes

* Replace deprecated cmpr() fn

---------

Co-authored-by: Taaha Mahdi <[email protected]>
  • Loading branch information
Brainicism and taahamahdi authored Oct 23, 2023
1 parent 1235755 commit 6bffba2
Show file tree
Hide file tree
Showing 18 changed files with 1,026 additions and 706 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"tabWidth": 4
"tabWidth": 4,
"trailingComma": "es5"
}
80 changes: 40 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,69 +37,69 @@
"dependencies": {
"@discordjs/opus": "^0.9.0",
"@distube/ytdl-core": "https://github.com/distubejs/ytdl-core",
"@fastify/view": "^7.4.1",
"@swc/core": "^1.3.44",
"@types/damerau-levenshtein": "^1.0.0",
"@types/ejs": "^3.1.2",
"@types/fluent-ffmpeg": "^2.1.21",
"@types/i18next-fs-backend": "^1.1.2",
"@types/lodash": "^4.14.192",
"@types/mocha": "^10.0.1",
"@types/node-schedule": "^2.1.0",
"@types/pluralize": "^0.0.29",
"@types/sinon": "^10.0.13",
"@types/tiny-async-pool": "^2.0.0",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@fastify/view": "^8.2.0",
"@swc/core": "^1.3.94",
"@types/damerau-levenshtein": "^1.0.1",
"@types/ejs": "^3.1.4",
"@types/fluent-ffmpeg": "^2.1.23",
"@types/i18next-fs-backend": "^1.1.4",
"@types/lodash": "^4.14.200",
"@types/mocha": "^10.0.3",
"@types/node-schedule": "^2.1.2",
"@types/pluralize": "^0.0.32",
"@types/sinon": "^10.0.20",
"@types/tiny-async-pool": "^2.0.1",
"@types/uuid": "^9.0.6",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"async-mutex": "^0.4.0",
"axios": "^1.3.4",
"bufferutil": "^4.0.7",
"commander": "^10.0.0",
"cron-parser": "^4.8.1",
"axios": "^1.5.1",
"bufferutil": "^4.0.8",
"commander": "^11.1.0",
"cron-parser": "^4.9.0",
"damerau-levenshtein": "^1.0.8",
"dotenv": "^16.0.3",
"dotenv": "^16.3.1",
"ejs": "^3.1.9",
"eris": "https://github.com/Brainicism/eris#6de9de0",
"eris-fleet": "https://github.com/Brainicism/eris-fleet#0a6c7c2",
"eris-pagination": "https://github.com/Brainicism/eris-pagination#9a112cb",
"erlpack": "https://github.com/abalabahaha/erlpack.git",
"fastify": "^4.15.0",
"fastify": "^4.24.3",
"fluent-ffmpeg": "^2.1.2",
"i18next": "^22.4.13",
"i18next-fs-backend": "^2.1.1",
"knex": "^2.4.2",
"kysely": "^0.24.2",
"i18next": "^23.6.0",
"i18next-fs-backend": "^2.2.0",
"knex": "^3.0.1",
"kysely": "^0.26.3",
"lodash": "^4.17.21",
"mocha": "^10.2.0",
"moment-timezone": "^0.5.42",
"mysql2": "^3.3.3",
"moment-timezone": "^0.5.43",
"mysql2": "^3.6.2",
"node-schedule": "^2.1.1",
"sinon": "^15.0.3",
"sodium-native": "^4.0.1",
"sinon": "^17.0.0",
"sodium-native": "^4.0.4",
"tiny-async-pool": "^2.1.0",
"ts-node": "^10.9.1",
"uuid": "^9.0.0",
"winston": "^3.8.2",
"uuid": "^9.0.1",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1",
"zlib-sync": "^0.1.8"
},
"devDependencies": {
"eslint": "^8.37.0",
"eslint": "^8.52.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-deprecation": "^1.3.3",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-i18n-json": "https://github.com/godaddy/eslint-plugin-i18n-json#13d5f18",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^40.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"eslint-plugin-tsdoc": "^0.2.17",
"kysely-codegen": "^0.10.0",
"prettier": "2.8.7",
"typescript": "~5.0.2"
"kysely-codegen": "^0.11.0",
"prettier": "3.0.3",
"typescript": "~5.2.2"
},
"description": "K-pop guessing game over Discord"
}
6 changes: 3 additions & 3 deletions src/commands/game_commands/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ async function lookupBySongName(

if (songName !== "") {
kmqSongEntriesQuery = kmqSongEntriesQuery
.where(({ or, cmpr }) =>
.where(({ or, eb }) =>
or([
cmpr("song_name_en", "like", `%${songName}%`),
cmpr("song_name_ko", "like", `%${songName}%`),
eb("song_name_en", "like", `%${songName}%`),
eb("song_name_ko", "like", `%${songName}%`),
])
)
.orderBy((eb) => eb.fn("CHAR_LENGTH", ["song_name_en"]), "asc")
Expand Down
5 changes: 2 additions & 3 deletions src/commands/game_commands/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,8 @@ export default class PlayCommand implements BaseCommand {
interaction?: Eris.CommandInteraction
): Promise<void> {
const guildID = messageContext.guildID;
const guildPreference = await GuildPreference.getGuildPreference(
guildID
);
const guildPreference =
await GuildPreference.getGuildPreference(guildID);

const voiceChannel = getUserVoiceChannel(messageContext);

Expand Down
5 changes: 2 additions & 3 deletions src/commands/game_options/exclude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ export default class ExcludeCommand implements BaseCommand {
.split(",")
.map((groupName) => groupName.trim());

const { matchedGroups, unmatchedGroups } = await getMatchingGroupNames(
groupNames
);
const { matchedGroups, unmatchedGroups } =
await getMatchingGroupNames(groupNames);

await ExcludeCommand.updateOption(
MessageContext.fromMessage(message),
Expand Down
5 changes: 2 additions & 3 deletions src/commands/game_options/include.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ export default class IncludeCommand implements BaseCommand {
.split(",")
.map((groupName) => groupName.trim());

const { matchedGroups, unmatchedGroups } = await getMatchingGroupNames(
groupNames
);
const { matchedGroups, unmatchedGroups } =
await getMatchingGroupNames(groupNames);

await IncludeCommand.updateOption(
MessageContext.fromMessage(message),
Expand Down
5 changes: 2 additions & 3 deletions src/commands/game_options/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ export default class RemoveCommand implements BaseCommand {
return;
}

const { matchedGroups, unmatchedGroups } = await getMatchingGroupNames(
rawGroupsToRemove
);
const { matchedGroups, unmatchedGroups } =
await getMatchingGroupNames(rawGroupsToRemove);

const remainingGroups = currentMatchedArtists.filter(
(group) => !matchedGroups.some((x) => x.id === group.id)
Expand Down
5 changes: 2 additions & 3 deletions src/commands/game_options/spotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ export default class SpotifyCommand implements BaseCommand {
reset = false
): Promise<void> {
const guildID = messageContext.guildID;
const guildPreference = await GuildPreference.getGuildPreference(
guildID
);
const guildPreference =
await GuildPreference.getGuildPreference(guildID);

const session = Session.getSession(guildID);
if (reset) {
Expand Down
5 changes: 2 additions & 3 deletions src/helpers/bot_listing_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ export default class BotListingManager {
process.env.BOT_CLIENT_ID as string
),
{
[botListing.payloadKeyName]: (
await this.ipc.getStats()
).guilds,
[botListing.payloadKeyName]: (await this.ipc.getStats())
.guilds,
},
{
headers: {
Expand Down
11 changes: 7 additions & 4 deletions src/helpers/discord_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1882,10 +1882,13 @@ export function getInteractionValue(
interactionKey: keys.join("."),
interactionOptions: (
options as Eris.InteractionDataOptionsWithValue[]
).reduce((result, filter: Eris.InteractionDataOptionsWithValue) => {
result[filter.name] = filter.value;
return result;
}, {} as { [name: string]: string | number | boolean }),
).reduce(
(result, filter: Eris.InteractionDataOptionsWithValue) => {
result[filter.name] = filter.value;
return result;
},
{} as { [name: string]: string | number | boolean }
),
interactionName: parentInteractionDataName,
focusedKey: options.find((x) => x["focused"])?.name ?? null,
};
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/game_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ export async function getSimilarGroupNames(
const similarGroups = await dbContext.kpopVideos
.selectFrom("app_kpop_group")
.select(["id", "name", "kname"])
.where(({ or, cmpr }) =>
.where(({ or, eb }) =>
or([
cmpr("name", "like", `%${groupName}%`),
cmpr("kname", "like", `%${groupName}%`),
eb("name", "like", `%${groupName}%`),
eb("kname", "like", `%${groupName}%`),
])
)
.orderBy((eb) => eb.fn("CHAR_LENGTH", ["name"]), "asc")
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/management_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ export async function reloadAliases(): Promise<void> {
"previous_name_ko",
])
.distinct()
.where(({ or, cmpr }) =>
.where(({ or, eb }) =>
or([
cmpr("artist_aliases", "<>", ""),
cmpr("previous_name_en", "<>", ""),
cmpr("previous_name_ko", "<>", ""),
eb("artist_aliases", "<>", ""),
eb("previous_name_en", "<>", ""),
eb("previous_name_ko", "<>", ""),
])
)
.execute();
Expand Down
28 changes: 14 additions & 14 deletions src/helpers/spotify_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,14 @@ export default class SpotifyManager {
const query = dbContext.kmq
.selectFrom("available_songs")
.innerJoin("kpop_videos.app_kpop_group", (jb) =>
jb.on(({ or, cmpr, ref }) =>
jb.on(({ or, eb, ref }) =>
or([
cmpr(
eb(
"kpop_videos.app_kpop_group.id",
"=",
ref("available_songs.id_artist")
),
cmpr(
eb(
"kpop_videos.app_kpop_group.id",
"=",
ref("available_songs.id_parent_artist")
Expand All @@ -511,50 +511,50 @@ export default class SpotifyManager {
)
)
.select(SongSelector.QueriedSongFields)
.where(({ cmpr, or }) =>
.where(({ eb, or }) =>
or(
songNames.map((songName) =>
cmpr(
eb(
"available_songs.clean_song_name_alpha_numeric",
"like",
songName.replace(/[^0-9a-z]/gi, "")
)
)
)
)
.where(({ or, cmpr, and }) => {
.where(({ or, eb, and }) => {
const expressions = [
cmpr(
eb(
"available_songs.original_artist_name_en",
"like",
song.artists[0]
),
and([
cmpr(
eb(
"available_songs.original_artist_name_en",
"like",
"%+%"
),
cmpr(
eb(
"available_songs.original_artist_name_en",
"like",
`%${song.artists[0]}%`
),
]),
cmpr(
eb(
"available_songs.previous_name_en",
"like",
song.artists[0]
),
cmpr("artist_aliases", "like", `%${song.artists[0]}%`),
eb("artist_aliases", "like", `%${song.artists[0]}%`),
];

if (aliasIDs.length) {
expressions.push(
...[
cmpr("id_parentgroup", "in", aliasIDs),
cmpr("id_artist", "in", aliasIDs),
cmpr("id_parent_artist", "in", aliasIDs),
eb("id_parentgroup", "in", aliasIDs),
eb("id_artist", "in", aliasIDs),
eb("id_parent_artist", "in", aliasIDs),
]
);
}
Expand Down
36 changes: 21 additions & 15 deletions src/scripts/announce-restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ function serverShutdown(
restartDate.setMinutes(restartDate.getMinutes() + restartMinutes);
await announceRestart(restartMinutes, restartDate, restart);

setTimeout(() => {
console.log("Stopping KMQ...");
cp.execSync(`APP_NAME=${appName} npm run docker-stop`);
}, restartMinutes * 1000 * 60);
setTimeout(
() => {
console.log("Stopping KMQ...");
cp.execSync(`APP_NAME=${appName} npm run docker-stop`);
},
restartMinutes * 1000 * 60
);
} else {
const oldAppName = `${appName}-old`;
console.log("Upgrading KMQ...");
Expand Down Expand Up @@ -143,17 +146,20 @@ function serverShutdown(
restartDate.setMinutes(restartDate.getMinutes() + restartMinutes);
await announceRestart(restartMinutes, restartDate, restart);

setTimeout(() => {
// drop old primary
console.log("Dropping old primary...");
cp.execSync(`docker rm -f ${oldAppName}`);

// promote standby to primary
console.log("Promoting standby to primary...");
cp.execSync(
`docker exec ${appName} /bin/sh -c "mv standby promoted"`
);
}, restartMinutes * 1000 * 60);
setTimeout(
() => {
// drop old primary
console.log("Dropping old primary...");
cp.execSync(`docker rm -f ${oldAppName}`);

// promote standby to primary
console.log("Promoting standby to primary...");
cp.execSync(
`docker exec ${appName} /bin/sh -c "mv standby promoted"`
);
},
restartMinutes * 1000 * 60
);
}
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/scripts/download-new-songs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,8 @@ const downloadSong = (db: DatabaseContext, id: string): Promise<void> => {
cacheStream.once("finish", async () => {
try {
await fs.promises.rename(tempLocation, cachedSongLocation);
const duration = await getAudioDurationInSeconds(
cachedSongLocation
);
const duration =
await getAudioDurationInSeconds(cachedSongLocation);

await db.kmq
.insertInto("cached_song_duration")
Expand Down
Loading

0 comments on commit 6bffba2

Please sign in to comment.