Migrate to TypeScript, minor changes and fixes (#46)

* docs: linting, require bun for ts

* rf: js -> ts

* chore: bump

* docs: add ts badge

* chore: bump types

* fix: add types for context to animal commands

* [m] hf: add bot type

* fix/types: add bot, ctx types, fix emoji on /dice cmd, add todo

* fix/types: bot admin checking fixes, other misc fixes, add types

---------

Co-authored-by: Lucas Gabriel <lucmsilva651@gmail.com>
This commit is contained in:
Aidan 2025-04-29 15:39:10 -04:00 committed by GitHub
parent 6fd5652afa
commit 07045d8e09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 550 additions and 325 deletions

View file

@ -17,6 +17,4 @@ function getStrings(languageCode) {
}
}
module.exports = {
getStrings
};
export { getStrings };

View file

@ -1,14 +0,0 @@
function verifyInput(ctx, userInput, message, verifyNaN = false) {
if (!userInput || (verifyNaN && isNaN(userInput))) {
ctx.reply(message, {
parse_mode: "Markdown",
reply_to_message_id: ctx.message.message_id
});
return true;
}
return false;
}
module.exports = {
verifyInput
};

View file

@ -0,0 +1,10 @@
export default function verifyInput(ctx: any, userInput: string, message: string, verifyNaN = false) {
if (!userInput || (verifyNaN && isNaN(Number(userInput)))) { // not sure why isNaN is used here, but the input should be a number
ctx.reply(message, {
parse_mode: "Markdown",
reply_to_message_id: ctx.message.message_id
});
return true;
}
return false;
}

View file

@ -1,7 +1,7 @@
const axios = require('axios');
const fs = require('fs');
const path = require('path');
const os = require('os');
import axios from 'axios';
import fs from 'fs';
import path from 'path';
import os from 'os';
const downloadDir = path.resolve(__dirname, 'yt-dlp');