mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Improve warning message
This commit is contained in:
@@ -31,14 +31,16 @@ export function openChat(config: ChatConfig): void {
|
||||
}
|
||||
|
||||
export async function openWarningChat(warningMessage: string): Promise<void> {
|
||||
const warningReasonMatch = warningMessage.match(/Warning reason: '(.+)'/);
|
||||
alert(chrome.i18n.getMessage("warningChatInfo") + `\n\n${warningReasonMatch ? ` Warning reason: ${warningReasonMatch[1]}` : ``}`);
|
||||
|
||||
const userNameData = await utils.asyncRequestToServer("GET", "/api/getUsername?userID=" + Config.config.userID);
|
||||
const userName = userNameData.ok ? JSON.parse(userNameData.responseText).userName : "";
|
||||
const publicUserID = await utils.getHash(Config.config.userID);
|
||||
const warningReasonMatch = warningMessage.match(/Warning reason: '(.+)'/);
|
||||
|
||||
openChat({
|
||||
displayName: `${userName ? userName : ``}${userName !== publicUserID ? ` | ${publicUserID}` : ``}`,
|
||||
composerInitialValue: `I got a warning and want to know what I need to do to improve.` +
|
||||
composerInitialValue: `I got a warning and confirm I [REMOVE THIS CAPITAL TEXT TO CONFIRM] reread the guidelines.` +
|
||||
warningReasonMatch ? ` Warning reason: ${warningReasonMatch[1]}` : ``,
|
||||
customDescription: chrome.i18n.getMessage("warningChatInfo")
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user