mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-12-23 04:31:06 +01:00
chore: updates
chore(githubUtils): replace ` feat(github): add formatEmojiStatus
This commit is contained in:
parent
587c58bec8
commit
094a59aa58
3 changed files with 6 additions and 6 deletions
|
@ -4,7 +4,7 @@ import { Command } from '../structures/Command';
|
|||
import utilities from '../../files/utilities.toml';
|
||||
import Collection from '@discordjs/collection';
|
||||
import { CommandContext } from '../structures/contexts/CommandContext';
|
||||
import { getIssueOrPR, search, formatStatus } from '../utils/githubUtils';
|
||||
import { getIssueOrPR, search, formatStatus, formatEmojiStatus } from '../utils/githubUtils';
|
||||
|
||||
const invalidIssue = (ctx: CommandContext, query: string) => {
|
||||
return ctx.editResponse(
|
||||
|
@ -76,7 +76,7 @@ new Command({
|
|||
}
|
||||
|
||||
return ctx.editResponse([
|
||||
`[#${issueOrPR.number} ${repositoryOwner}/${repositoryName}](<${issueOrPR.html_url}>) by [${issueOrPR.user_login}](<${issueOrPR.user_html_url}>) ${formatStatus(issueOrPR)}`,
|
||||
`${formatEmojiStatus(issueOrPR)} [#${issueOrPR.number} ${repositoryOwner}/${repositoryName}](<${issueOrPR.html_url}>) by [${issueOrPR.user_login}](<${issueOrPR.user_html_url}>) ${formatStatus(issueOrPR)}`,
|
||||
issueOrPR.title
|
||||
].join('\n'));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import MiniSearch from 'minisearch';
|
|||
import { Logger } from './Logger';
|
||||
import { APIApplicationCommandOptionChoice } from 'discord-api-types/v10';
|
||||
import { Database } from 'bun:sqlite';
|
||||
import { discordChoicesRegex } from './regexes';
|
||||
import { githubTitleClean } from './regexes';
|
||||
|
||||
interface Issue {
|
||||
id: number;
|
||||
|
@ -186,7 +186,7 @@ export const search = async(query: string, repository: string): Promise<APIAppli
|
|||
if (!query) {
|
||||
const array = arrayFiltered.slice(0, 25);
|
||||
return array.map((issueOrPr: Issue | PullRequest) => new Object({
|
||||
name: `${issueOrPr.type} ${formatEmojiStatus(issueOrPr)} ${issueOrPr.title.slice(0, 93)}`,
|
||||
name: `${issueOrPr.type} ${formatEmojiStatus(issueOrPr)} ${issueOrPr.title.slice(0, 93).replace(githubTitleClean, '')}`,
|
||||
value: issueOrPr.number.toString()
|
||||
})) as APIApplicationCommandOptionChoice[]
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ export const search = async(query: string, repository: string): Promise<APIAppli
|
|||
const result = searcher.search(query);
|
||||
|
||||
return (result as unknown as Issue[] | PullRequest[]).slice(0, 25).map((issueOrPr: Issue | PullRequest) => new Object({
|
||||
name: `${issueOrPr.type} ${formatEmojiStatus(issueOrPr)} ${issueOrPr.title.slice(0, 93)}`,
|
||||
name: `${issueOrPr.type} ${formatEmojiStatus(issueOrPr)} ${issueOrPr.title.slice(0, 93).replace(githubTitleClean, '')}`,
|
||||
value: issueOrPr.number.toString()
|
||||
})) as APIApplicationCommandOptionChoice[]
|
||||
} catch(e) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
export const discordChoicesRegex = /[^a-z0-9 (|)|-|*|/|+|,|<|>|&|!|?]/gi;
|
||||
export const githubTitleClean = /[`]/gi;
|
Loading…
Reference in a new issue