Skip to content

Commit

Permalink
Merge pull request #67 from cmd1152/main
Browse files Browse the repository at this point in the history
add plugin
  • Loading branch information
0x24a authored Jul 14, 2024
2 parents 06f1bdd + d509650 commit 1cc2c4c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
38 changes: 38 additions & 0 deletions plugins/hc_replay/index.js
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}`
})
}
}
7 changes: 7 additions & 0 deletions plugins/hc_replay/plugin.json
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"
}
3 changes: 2 additions & 1 deletion plugins/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"fast_know_kick_me",
"edit_msg",
"quit_hc",
"pangu"
"pangu",
"hc_replay"
]
}

0 comments on commit 1cc2c4c

Please sign in to comment.