mirror of
https://github.com/SrIzan10/femboybot.git
synced 2026-06-06 00:56:50 +00:00
feat: eval and tiktok fix
This commit is contained in:
45
commands/misc/eval.ts
Normal file
45
commands/misc/eval.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { commandModule, CommandType } from "@sern/handler";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { inspect } from "node:util";
|
||||
|
||||
export default commandModule({
|
||||
type: CommandType.Text,
|
||||
//alias : [],
|
||||
execute: async (ctx, args) => {
|
||||
if (ctx.user.id !== '703974042700611634') return await ctx.reply('no')
|
||||
|
||||
let code: string[] | string = args[1];
|
||||
code = code.join(" ") as string;
|
||||
if (code.includes("await")) {
|
||||
const ar = code.split(";");
|
||||
const last = ar.pop();
|
||||
code = `(async () => {\n${ar.join(";\n")}\nreturn ${
|
||||
last?.trim() ?? " "
|
||||
}\n\n})();`;
|
||||
}
|
||||
const { channel, guild, client, user, member, message } = ctx;
|
||||
|
||||
let result: unknown | string;
|
||||
|
||||
try {
|
||||
result = eval(code);
|
||||
} catch (error) {
|
||||
result = error;
|
||||
}
|
||||
if (result instanceof Promise)
|
||||
result = await result.catch((e: Error) => new Error(e.message));
|
||||
if (typeof result !== "string") {
|
||||
result = inspect(result, {
|
||||
depth: 0,
|
||||
});
|
||||
}
|
||||
|
||||
result = "```js\n" + result + "\n```";
|
||||
|
||||
if ((result as string).length > 2000) {
|
||||
channel!.send("Result is too long to send");
|
||||
}
|
||||
|
||||
ctx.channel!.send({ content: result as string });
|
||||
},
|
||||
});
|
||||
10
events/djs/movePablo.ts
Normal file
10
events/djs/movePablo.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { EventType, eventModule } from "@sern/handler";
|
||||
import { VoiceState } from "discord.js";
|
||||
|
||||
export default eventModule({
|
||||
type: EventType.Discord,
|
||||
name: 'voiceStateUpdate',
|
||||
execute: async (oldState: VoiceState, newState: VoiceState) => {
|
||||
if (newState.member!.id !== '954042602615869520') return;
|
||||
},
|
||||
});
|
||||
@@ -19,17 +19,18 @@ export default eventModule({
|
||||
link = message.content.substring(index, endIndex);
|
||||
}
|
||||
|
||||
const scrap = await axios.get(`https://www.tikwm.com/api/?url=${link}`).then(res => res.data)
|
||||
const shorten = await axios.get(`http://chilp.it/api.php?url=${scrap.data.play}`).then(res => res.data)
|
||||
const scrap = await axios.get(`https://www.tikwm.com/api/?url=${link}`, { headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' } }).then(res => res.data)
|
||||
const shorten = await axios.post(`https://cleanuri.com/api/v1/shorten`, { 'url': scrap.data.play }).then(res => res.data)
|
||||
const audio = await axios.get(scrap.data.music, { responseType: 'arraybuffer' }).then(res => res.data)
|
||||
const audioAttachment = new AttachmentBuilder(audio, { name: 'audio.mp3' })
|
||||
|
||||
await message.reply({
|
||||
content: `Vídeo: ${shorten}`,
|
||||
content: `Vídeo: ${shorten.result_url}`,
|
||||
files: [audioAttachment]
|
||||
})
|
||||
} catch {
|
||||
} catch (e) {
|
||||
message.react('❌')
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user