Init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { MatrixClient } from "matrix-bot-sdk";
|
||||
import { CommandData } from "../types/Command";
|
||||
import Logger from "../util/Logger";
|
||||
import { cd } from "..";
|
||||
|
||||
export const Command: CommandData = {
|
||||
name: 'repeat',
|
||||
description: 'w...',
|
||||
usage: false,
|
||||
execute: async (client: MatrixClient, roomId: string, event: any, userInput: any) => {
|
||||
//await client.replyNotice(roomId, event, "😭");
|
||||
userInput = userInput.replace('sob!repeat ', '')
|
||||
var initial: string[] = userInput.split(';;;') // initial[0]: text to spam
|
||||
|
||||
try {
|
||||
if (initial[1] === "@") {
|
||||
var times = parseInt(initial[2])
|
||||
cd.quiet(`Times: ${times.toString()}`)
|
||||
for (let i = 0; i < times; i++) {
|
||||
if (i != (times - 1))
|
||||
await client.sendMessage(roomId, {
|
||||
msgtype: "m.text",
|
||||
body: initial[0],
|
||||
})
|
||||
}
|
||||
return initial[0]
|
||||
}
|
||||
return initial[0]
|
||||
} catch (err) {
|
||||
return err.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Command
|
||||
Reference in New Issue
Block a user