-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from cmd1152/main
add plugin
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
run.replay = async (...args) => { | ||
pushMessage({ | ||
nick: '*', | ||
text: `Createing HCReplay URL...` | ||
}) | ||
try { | ||
const content = [...document.querySelectorAll(".message")].map((msg)=>{ | ||
return msg.querySelector("p") | ||
}).filter((msg)=>{return msg}).map((msg)=>{ | ||
return msg.getAttribute('data-raw') | ||
}).join("\n"); | ||
|
||
const blob = new Blob([content], { type: 'text/plain' }); | ||
const file = new File([blob], "ilove4n0n4me.txt", { type: 'text/plain' }); | ||
const formData = new FormData(); | ||
formData.append('reqtype', 'fileupload'); | ||
formData.append('userhash', ''); | ||
formData.append('fileToUpload', file); | ||
const response = await camoFetch('https://catbox.moe/user/api.php', { | ||
method: 'POST', | ||
body: formData | ||
}); | ||
const box_url = await response.text(); | ||
const replay_url = `https://cmd1152.github.io/hchistory/?t=0&u=${box_url.replace("https://files.catbox.moe/","cb/")}` | ||
if (!box_url.startsWith("http")) { | ||
throw "Failed to Update File" | ||
} | ||
pushMessage({ | ||
nick: '*', | ||
text: replay_url | ||
}) | ||
} catch (err) { | ||
pushMessage({ | ||
nick: '!', | ||
text: `Failed to create HCReplay URL: ${err.message||err}` | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"id":"hc_replay", | ||
"name":"HCReplay", | ||
"description":"Adds a /replay Command to create HCReplay url.", | ||
"author":"cmd1152", | ||
"contact":"cmd1152__@Discord" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"fast_know_kick_me", | ||
"edit_msg", | ||
"quit_hc", | ||
"pangu" | ||
"pangu", | ||
"hc_replay" | ||
] | ||
} |