├── .prettierrc ├── src ├── bot │ ├── helpers │ │ ├── get-file-extension.ts │ │ ├── html-escaper.ts │ │ └── reply-markup-builder.ts │ ├── models │ │ ├── file-conversion.ts │ │ ├── pass-through-stream.ts │ │ ├── task-context.ts │ │ └── cloud-convert.ts │ ├── controllers │ │ ├── fallback-controller.ts │ │ ├── group-controller.ts │ │ ├── apikey-controller.ts │ │ ├── callback-controller.ts │ │ ├── controller-utils.ts │ │ ├── command-controller.ts │ │ └── file-controller.ts │ ├── middlewares │ │ └── command-args.ts │ ├── bot.ts │ └── locales │ │ ├── ar-ye.json │ │ ├── it.json │ │ ├── en.json │ │ ├── kn.json │ │ ├── es.json │ │ ├── de.json │ │ ├── ru.json │ │ ├── br.json │ │ └── id.json ├── app.ts └── types │ └── cloudconvert │ └── index.d.ts ├── app.yaml ├── .env.example ├── .vscode ├── extensions.json └── settings.json ├── .gcloudignore ├── tsconfig.json ├── .github └── FUNDING.yml ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── package.json ├── README.md └── LICENSE /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "htmlWhitespaceSensitivity": "ignore", 5 | "tabWidth": 4, 6 | "semi": false, 7 | "arrowParens": "avoid", 8 | } 9 | -------------------------------------------------------------------------------- /src/bot/helpers/get-file-extension.ts: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | 3 | export function ext(file: string): string { 4 | return path.extname(file).substring(1) // drop ».« of file extension 5 | } 6 | -------------------------------------------------------------------------------- /app.yaml: -------------------------------------------------------------------------------- 1 | runtime: nodejs12 2 | 3 | instance_class: F1 4 | automatic_scaling: 5 | min_instances: 1 6 | max_instances: 1 7 | 8 | handlers: 9 | - url: /.* 10 | secure: always 11 | redirect_http_response_code: 301 12 | script: auto 13 | 14 | network: 15 | forwarded_ports: 16 | - 443 17 | -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | // enable environment vars 2 | import { config } from 'dotenv' 3 | config() 4 | 5 | import d from 'debug' 6 | import Bot from './bot/bot' 7 | 8 | const debug = d('app') 9 | 10 | const bot = new Bot() 11 | try { 12 | bot.start().then(() => debug('Bot started.')) 13 | } catch (e) { 14 | debug('Failed to start: ' + e) 15 | } 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | BOT_API_TOKEN=YOUR_TOKEN_HERE 2 | BOT_API_TOKEN_DEV=YOUR_DEV_TOKEN_HERE 3 | 4 | CLOUD_CONVERT_API_TOKEN=YOUR_CLOUD_CONVERT_TOKEN_HERE 5 | CLOUD_CONVERT_API_TOKEN_DEV=YOUR_CLOUD_CONVERT_DEV_TOKEN_HERE # could be the same as for CLOUD_CONVERT_API_TOKEN 6 | 7 | ADMIN_ID=YOUR_DEBUG_LOG_CHANNEL_ID_HERE 8 | ADMIN_ID_DEV=YOUR_DEV_DEBUG_LOG_CHANNEL_ID_HERE # could be the same as for ADMIN_ID 9 | -------------------------------------------------------------------------------- /src/bot/helpers/html-escaper.ts: -------------------------------------------------------------------------------- 1 | // functions for HTML tag escaping, based on https://stackoverflow.com/a/5499821/ 2 | const tagsToEscape = { 3 | '&': '&', 4 | '<': '<', 5 | '>': '>', 6 | } 7 | function escapeTag(tag: string): string { 8 | return tagsToEscape[tag as '&' | '<' | '>'] || tag 9 | } 10 | 11 | export function escapeHtmlTags(str: string): string { 12 | return str.replace(/[&<>]/g, escapeTag) 13 | } 14 | -------------------------------------------------------------------------------- /src/bot/models/file-conversion.ts: -------------------------------------------------------------------------------- 1 | import { Boolean, Record, Static, String } from 'runtypes' 2 | 3 | export const FileConversionType = Record({ 4 | from: String, 5 | to: String, 6 | }) 7 | export type FileConversion = Static 8 | 9 | export const AutoFileConversionType = FileConversionType.And( 10 | Record({ 11 | auto: Boolean, 12 | }) 13 | ) 14 | export type AutoFileConversion = Static 15 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. 3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp 4 | // List of extensions which should be recommended for users of this workspace. 5 | "recommendations": [ 6 | "dbaeumer.vscode-eslint" 7 | ], 8 | // List of extensions recommended by VS Code that should not be recommended for users of this workspace. 9 | "unwantedRecommendations": [] 10 | } 11 | -------------------------------------------------------------------------------- /src/bot/controllers/fallback-controller.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import TaskContext from '../models/task-context' 3 | const debug = d('bot:contr:cb') 4 | 5 | export async function help(ctx: TaskContext): Promise { 6 | debug('Fallback! Sending generic help message.') 7 | if (ctx.message?.chat.type === 'private') { 8 | const message = 9 | (await ctx.session).api_key === undefined 10 | ? ctx.i18n.t('helpmsgTextKeySuggestion') 11 | : ctx.i18n.t('helpmsgText') 12 | await ctx.reply(message) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.gcloudignore: -------------------------------------------------------------------------------- 1 | # This file specifies files that are *not* uploaded to Google Cloud Platform 2 | # using gcloud. It follows the same syntax as .gitignore, with the addition of 3 | # "#!include" directives (which insert the entries of the given .gitignore-style 4 | # file at that point). 5 | # 6 | # For more information, run: 7 | # $ gcloud topic gcloudignore 8 | # 9 | .gcloudignore 10 | # If you would like to upload your .git directory, .gitignore file or files 11 | # from your .gitignore file, remove the corresponding line 12 | # below: 13 | .git 14 | .gitignore 15 | 16 | # Node.js dependencies: 17 | node_modules/ 18 | 19 | # TypeScript output 20 | built/ 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.enableFiletypes": [ 3 | "asciidoc", 4 | "css", 5 | "dockerfile", 6 | "dotenv", 7 | "html", 8 | "jade", 9 | "javascript", 10 | "json", 11 | "jsonc", 12 | "markdown", 13 | "pdf", 14 | "plaintext", 15 | "python", 16 | "restructuredtext", 17 | "rst", 18 | "scss", 19 | "sql", 20 | "svg", 21 | "text", 22 | "typescript", 23 | "vue", 24 | "vue-html", 25 | "vue-postcss", 26 | "xml", 27 | "yaml", 28 | "yml" 29 | ], 30 | "cSpell.language": "en,en-GB,en-US,de,de-DE", 31 | "typescript.tsdk": "node_modules/typescript/lib" 32 | } 33 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "charset": "utf8", 4 | "declaration": true, 5 | "esModuleInterop": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "keyofStringsOnly": true, 8 | "module": "commonjs", 9 | "newLine": "lf", 10 | "noFallthroughCasesInSwitch": true, 11 | "noImplicitReturns": true, 12 | "noUnusedParameters": true, 13 | "outDir": "./built/", 14 | "removeComments": true, 15 | "sourceMap": true, 16 | "strict": true, 17 | "target": "es6", 18 | "typeRoots": [ 19 | "./src/types", 20 | "./node_modules/@types" 21 | ] 22 | }, 23 | "include": [ 24 | "src/**/*" 25 | ], 26 | "exclude": [] 27 | } 28 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [KnorpelSenf] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | # Matches multiple files with brace expansion notation 13 | # Set default charset 14 | [*.{ts}] 15 | charset = utf-8 16 | 17 | # 4 space indentation 18 | [*.ts] 19 | indent_style = space 20 | indent_size = 4 21 | 22 | # Tab indentation (no size specified) 23 | [Makefile] 24 | indent_style = tab 25 | 26 | # Indentation override for all JS under lib directory 27 | [node_modules/**.js] 28 | indent_style = space 29 | indent_size = 2 30 | 31 | # Matches the exact files either package.json 32 | [{package.json}] 33 | indent_style = space 34 | indent_size = 2 35 | -------------------------------------------------------------------------------- /src/bot/models/pass-through-stream.ts: -------------------------------------------------------------------------------- 1 | import { Transform, TransformCallback } from 'stream' 2 | // Stream implementation that conforms to both WriteStream and ReadStream 3 | // and simply forwards all data 4 | export class PassThroughStream extends Transform { 5 | public bytesWritten = 0 6 | // Hold dummy file path 7 | public readonly path: string = '/tmp/' + this.fileName 8 | // Alias close method 9 | public close = this.end 10 | public constructor(public fileName: string) { 11 | super() 12 | } 13 | // Simply pass through all data chunks 14 | public _transform(chunk: any, _: string, cb: TransformCallback): void { 15 | this.push(chunk) 16 | if (typeof chunk.length === 'number') { 17 | this.bytesWritten += chunk.length 18 | } 19 | setImmediate(cb) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | mocha: true, 6 | es6: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/recommended', 11 | 'prettier/@typescript-eslint', 12 | 'plugin:prettier/recommended', 13 | ], 14 | rules: { 15 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 16 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 17 | '@typescript-eslint/no-unused-vars': 'error', 18 | '@typescript-eslint/no-explicit-any': 0, 19 | '@typescript-eslint/explicit-function-return-type': [ 20 | 'error', 21 | { 22 | allowExpressions: true, 23 | }, 24 | ], 25 | 'object-shorthand': ['error', 'always', { avoidQuotes: true }], 26 | }, 27 | parserOptions: { 28 | parser: '@typescript-eslint/parser', 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /src/bot/models/task-context.ts: -------------------------------------------------------------------------------- 1 | import type { Firestore } from '@google-cloud/firestore' 2 | import type { ContextMessageUpdate } from 'telegraf' 3 | import type I18n from 'telegraf-i18n' 4 | import type { BotInfo } from '../bot' 5 | import type { FileConversion } from './file-conversion' 6 | 7 | export default interface TaskContext extends ContextMessageUpdate { 8 | // Set upon initialization 9 | botInfo: BotInfo 10 | // Set by command-args middleware: 11 | command?: { 12 | raw: string 13 | command: string 14 | args: string[] 15 | } 16 | // Session read from firebase 17 | session: Promise | SessionData 18 | // Database 19 | db: Firestore 20 | // I18nContext object permitting access to localized strings (the lib is missing types) 21 | i18n: Pick 22 | supportedLanguages: Array<{ name: string; locale: string }> 23 | } 24 | 25 | export interface SessionData { 26 | task?: FileTask 27 | api_key?: string 28 | auto?: FileConversion[] 29 | } 30 | 31 | export interface FileTask { 32 | file_id?: string 33 | target_format?: string 34 | file_name?: string 35 | } 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # firestore secrets 61 | firestore-keyfile.json 62 | 63 | # next.js build output 64 | .next 65 | 66 | # Built .js files 67 | built/ 68 | -------------------------------------------------------------------------------- /src/bot/controllers/group-controller.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import TaskContext from '../models/task-context' 3 | const debug = d('bot:contr:group') 4 | 5 | export async function addedToGroup(ctx: TaskContext): Promise { 6 | if ( 7 | ctx.message?.new_chat_members !== undefined && 8 | ctx.message.new_chat_members.some(user => user.id === ctx.botInfo.id) 9 | ) { 10 | debug('Added to group') 11 | let message = ctx.i18n.t('helpmsgStartGroups') 12 | // Re-use potentially existing API from the user who invited us 13 | if (ctx.message.from?.id !== undefined) { 14 | const doc = await ctx.db 15 | .collection('sessions') 16 | .doc(ctx.message.from.id.toString()) 17 | .get() 18 | if (doc.exists) { 19 | const fromSession = doc.data() 20 | if (fromSession?.api_key !== undefined) { 21 | // eslint-disable-next-line @typescript-eslint/camelcase 22 | ;(await ctx.session).api_key = fromSession.api_key 23 | message += '\n' + ctx.i18n.t('personalApiKeyInUse') 24 | } 25 | } 26 | } 27 | await ctx.replyWithHTML(message) 28 | } 29 | } 30 | 31 | export async function removedFromGroup(ctx: TaskContext): Promise { 32 | if (ctx.message?.left_chat_member?.id === ctx.botInfo.id) { 33 | debug('Removed from group') 34 | ctx.session = {} 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/bot/helpers/reply-markup-builder.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/camelcase */ 2 | import { InlineKeyboardMarkup } from 'telegram-typings' 3 | import { AutoFileConversion } from '../models/file-conversion' 4 | import TaskContext from '../models/task-context' 5 | 6 | export function autoConversionReplyMarkup( 7 | ctx: TaskContext, 8 | conversion: AutoFileConversion 9 | ): InlineKeyboardMarkup { 10 | const buttonText = 11 | ctx.i18n.t('autoConvert', { 12 | from: conversion.from, 13 | to: conversion.to, 14 | }) + 15 | ': ' + 16 | (conversion.auto 17 | ? String.fromCodePoint(0x2705) // green tick emoji 18 | : String.fromCodePoint(0x274c)) // red cross emoji 19 | return { 20 | inline_keyboard: [ 21 | [ 22 | { 23 | text: buttonText, 24 | callback_data: JSON.stringify(conversion), 25 | }, 26 | ], 27 | ], 28 | } 29 | } 30 | 31 | export function cancelOperationReplyMarkup( 32 | ctx: TaskContext 33 | ): InlineKeyboardMarkup { 34 | return { 35 | inline_keyboard: [ 36 | [ 37 | { 38 | text: ctx.i18n.t('cancelOperation'), // button text 39 | callback_data: JSON.stringify({ cancel: true }), 40 | }, 41 | ], 42 | ], 43 | } 44 | } 45 | 46 | export function selectLanguageReplyMarkup( 47 | ctx: TaskContext 48 | ): InlineKeyboardMarkup { 49 | return { 50 | inline_keyboard: ctx.supportedLanguages.map(l => [ 51 | { 52 | text: l.name, 53 | callback_data: JSON.stringify({ lang: l.locale }), 54 | }, 55 | ]), 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/bot/middlewares/command-args.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import { Middleware } from 'telegraf' 3 | import TaskContext from '../models/task-context' 4 | const debug = d('bot:mw:cargs') 5 | 6 | // Loosely based on https://larsgraubner.com/telegraf-middleware-command-arguments/ 7 | export default (): Middleware => (ctx, next) => { 8 | if ( 9 | ctx.updateType === 'message' && 10 | ctx.message !== undefined && 11 | ((ctx.message.text !== undefined && ctx.message.text.startsWith('/')) || 12 | (ctx.message.caption !== undefined && 13 | ctx.message.caption.startsWith('/'))) 14 | ) { 15 | const raw = 16 | ctx.message.text || 17 | ctx.message.caption || 18 | 'this will never happen, but if it does, it will not match the regex' 19 | const match = raw.match(/^\/([^\s]+)\s?([\s\S]+)?/) 20 | if (match !== null) { 21 | // Require @ notation in groups, supergroups and channels 22 | if ( 23 | ctx.message.chat.type === 'private' || 24 | (match[1].includes('@') && 25 | match[1].split('@', 2)[1] === ctx.botInfo.username) 26 | ) { 27 | const command: string = match[1] 28 | ? match[1].includes('@') 29 | ? match[1].split('@', 2)[0] 30 | : match[1] 31 | : '' 32 | const args: string[] = match[2] 33 | ? match[2].split(/\s/).filter(arg => !!arg) 34 | : [] 35 | ctx.command = { raw, command, args } 36 | debug(ctx.command) 37 | } 38 | } 39 | } 40 | if (next !== undefined) { 41 | return next() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloudconvert-bot", 3 | "description": "Telegram bot forwarding files to cloudconvert.com to convert them", 4 | "version": "2.1.0", 5 | "private": true, 6 | "license": "AGPL", 7 | "author": "@KnorpelSenf", 8 | "engines": { 9 | "node": ">=8.0.0" 10 | }, 11 | "scripts": { 12 | "prepare": "npm run gcp-build", 13 | "build": "tsc", 14 | "postbuild": "rm -rf built/bot/locales/ && cp -r src/bot/locales/ built/bot/", 15 | "gcp-build": "tsc && cp -r src/bot/locales/ built/bot/", 16 | "start": "DEBUG=app,err node built/app.js", 17 | "debug": "DEBUG='*' node built/app.js", 18 | "clean": "rm -r built/*", 19 | "lint": "eslint -c .eslintrc.js --ext .ts src", 20 | "deploy": "gcloud app deploy" 21 | }, 22 | "dependencies": { 23 | "@google-cloud/firestore": "^7.6.0", 24 | "@types/debug": "^4.1.5", 25 | "@types/express": "^4.17.3", 26 | "@types/treeify": "^1.0.0", 27 | "axios": "^0.28.0", 28 | "cloudconvert": "^2.3.4", 29 | "debug": "^4.3.1", 30 | "dotenv": "^8.2.0", 31 | "express": "^4.19.2", 32 | "runtypes": "^4.2.0", 33 | "telegraf": "^3.36.0", 34 | "telegraf-i18n": "^6.6.0", 35 | "telegraf-session-firestore": "^2.2.1", 36 | "treeify": "^1.1.0", 37 | "typescript": "^3.8.3" 38 | }, 39 | "devDependencies": { 40 | "@typescript-eslint/eslint-plugin": "^2.27.0", 41 | "@typescript-eslint/eslint-plugin-tslint": "^2.27.0", 42 | "@typescript-eslint/parser": "^2.27.0", 43 | "eslint": "^6.8.0", 44 | "eslint-config-prettier": "^6.10.1", 45 | "eslint-config-typescript": "^3.0.0", 46 | "eslint-plugin-prettier": "^3.1.2", 47 | "prettier": "^2.0.4" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/bot/controllers/apikey-controller.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import * as htmlUtils from '../helpers/html-escaper' 3 | import * as cloudconvert from '../models/cloud-convert' 4 | import TaskContext from '../models/task-context' 5 | const debug = d('bot:contr:apikey') 6 | 7 | export async function receivedApiKey( 8 | ctx: TaskContext, 9 | apiKey: string 10 | ): Promise { 11 | debug('New key') 12 | if (ctx.message !== undefined && apiKey.length > 0) { 13 | const statusMessage = await ctx.reply(ctx.i18n.t('validatingApiKey'), { 14 | // eslint-disable-next-line @typescript-eslint/camelcase 15 | reply_to_message_id: ctx.message.message_id, 16 | }) 17 | const username = await cloudconvert.validateApiKey(apiKey) 18 | const valid = username !== undefined 19 | if (valid) { 20 | // eslint-disable-next-line @typescript-eslint/camelcase 21 | ;(await ctx.session).api_key = apiKey 22 | await ctx.telegram.editMessageText( 23 | statusMessage.chat.id, 24 | statusMessage.message_id, 25 | undefined, 26 | '' + username + '\n' + ctx.i18n.t('apiKeyProvided'), 27 | { 28 | // eslint-disable-next-line @typescript-eslint/camelcase 29 | reply_to_message_id: ctx.message.message_id, 30 | // eslint-disable-next-line @typescript-eslint/camelcase 31 | parse_mode: 'HTML', 32 | } 33 | ) 34 | } else { 35 | await ctx.telegram.editMessageText( 36 | statusMessage.chat.id, 37 | statusMessage.message_id, 38 | undefined, 39 | ctx.i18n.t('invalidApiKey') + htmlUtils.escapeHtmlTags(apiKey), 40 | { 41 | // eslint-disable-next-line @typescript-eslint/camelcase 42 | reply_to_message_id: ctx.message.message_id, 43 | // eslint-disable-next-line @typescript-eslint/camelcase 44 | parse_mode: 'HTML', 45 | } 46 | ) 47 | } 48 | } 49 | } 50 | 51 | export async function handleTextMessage( 52 | ctx: TaskContext, 53 | next: (() => any) | undefined 54 | ): Promise { 55 | if ( 56 | ctx?.message?.text !== undefined && 57 | ctx.message?.reply_to_message?.from?.id === ctx.botInfo.id && 58 | ctx.message.reply_to_message?.text === ctx.i18n.t('sendApiKey') 59 | ) { 60 | debug('Handle API key') 61 | 62 | let apiKey = ctx.message.text 63 | 64 | // In the unlikely case that the user responds with /apikey before sending the actual API key 65 | if (apiKey.startsWith('/apikey')) { 66 | apiKey = apiKey.substring(7).trim() 67 | if (apiKey.startsWith('@') && ctx.botInfo.username !== undefined) { 68 | apiKey = apiKey 69 | .substring(ctx.botInfo.username.length + 1) 70 | .trim() 71 | } 72 | } 73 | 74 | await receivedApiKey(ctx, apiKey) 75 | } else if (next !== undefined) { 76 | return next() 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/bot/controllers/callback-controller.ts: -------------------------------------------------------------------------------- 1 | import { Boolean, Record, Static, String } from 'runtypes' 2 | import { 3 | autoConversionReplyMarkup, 4 | selectLanguageReplyMarkup, 5 | } from '../helpers/reply-markup-builder' 6 | import { 7 | AutoFileConversion, 8 | AutoFileConversionType, 9 | } from '../models/file-conversion' 10 | import TaskContext from '../models/task-context' 11 | 12 | const CallbackQueryDataType = AutoFileConversionType.Or( 13 | Record({ 14 | cancel: Boolean, 15 | }) 16 | ).Or( 17 | Record({ 18 | lang: String, 19 | }) 20 | ) 21 | type CallbackQueryData = Static 22 | 23 | async function cancel(ctx: TaskContext): Promise { 24 | const [session] = await Promise.all([ 25 | ctx.session, 26 | ctx.answerCbQuery(), 27 | ctx.editMessageText(ctx.i18n.t('operationCancelled')), 28 | ]) 29 | delete session.task 30 | } 31 | 32 | async function setLanguage(ctx: TaskContext, lang: string): Promise { 33 | if (ctx.i18n.locale() !== lang) { 34 | ctx.i18n.locale(lang) 35 | await Promise.all([ 36 | ctx.editMessageText(ctx.i18n.t('pickLanguage'), { 37 | // eslint-disable-next-line @typescript-eslint/camelcase 38 | reply_markup: selectLanguageReplyMarkup(ctx), 39 | // eslint-disable-next-line @typescript-eslint/camelcase 40 | parse_mode: 'HTML', 41 | // eslint-disable-next-line @typescript-eslint/camelcase 42 | disable_web_page_preview: true, 43 | }), 44 | ctx.answerCbQuery(), 45 | ]) 46 | } 47 | } 48 | 49 | async function toggleAutoConversion( 50 | ctx: TaskContext, 51 | data: AutoFileConversion 52 | ): Promise { 53 | /* 54 | Callback query data has the shape of type AutoFileConversion 55 | (assuming the payload is about auto-conversions). 56 | 57 | Database entries have a property "auto" of this structure: 58 | [ 59 | { 60 | from: "mp4", 61 | to: "avi" 62 | }, 63 | { 64 | from: "epub", 65 | to: "pdf" 66 | }, 67 | ... 68 | ] 69 | Every entry in the above list represents a conversion (aka. a pair of 70 | file extensions) to be performed automatically. 71 | */ 72 | const session = await ctx.session 73 | // toggle state 74 | data.auto = !data.auto 75 | // this is the conversion to be toggled 76 | const conversion = { from: data.from, to: data.to } 77 | session.auto = session.auto || [] 78 | // first remove conversion from list 79 | session.auto = session.auto.filter( 80 | c => c.from !== conversion.from && c.to !== conversion.to 81 | ) 82 | // then add if necessary 83 | const desired = data.auto 84 | if (desired) { 85 | session.auto.push(conversion) 86 | } 87 | if (session.auto.length === 0) { 88 | delete session.auto 89 | } 90 | try { 91 | await ctx.editMessageReplyMarkup(autoConversionReplyMarkup(ctx, data)) 92 | } catch (e) { 93 | // “Bad Request: message is not modified” happens if users spam the button 94 | // and several conflicting updates are processed in parallel. 95 | // We just ignore the update in this case because the correct data are eventually displayed anyway 96 | } 97 | await ctx.answerCbQuery(ctx.i18n.t('autoConversionSaved')) 98 | } 99 | 100 | export async function handleCallbackQuery(ctx: TaskContext): Promise { 101 | const query = ctx.callbackQuery 102 | if (query?.data !== undefined && query.message !== undefined) { 103 | const data: CallbackQueryData = CallbackQueryDataType.check( 104 | JSON.parse(query.data) 105 | ) 106 | if ('cancel' in data) { 107 | // Conversion was cancelled 108 | await cancel(ctx) 109 | } else if ('lang' in data) { 110 | // New language was set 111 | await setLanguage(ctx, data.lang) 112 | } else { 113 | // Auto-conversion was toggled 114 | await toggleAutoConversion(ctx, data) 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/bot/controllers/controller-utils.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import { ExtraReplyMessage } from 'telegraf/typings/telegram-types' 3 | import * as util from '../helpers/get-file-extension' 4 | import { cancelOperationReplyMarkup } from '../helpers/reply-markup-builder' 5 | import TaskContext from '../models/task-context' 6 | import * as cloudconvert from './../models/cloud-convert' 7 | 8 | // Helper function to get unique values in array 9 | function uniques(element: E, index: number, array: E[]): boolean { 10 | return array.indexOf(element) === index 11 | } 12 | 13 | export async function printPossibleConversions( 14 | ctx: TaskContext, 15 | fileId: string 16 | ): Promise { 17 | let fileUrl: string 18 | try { 19 | fileUrl = await ctx.telegram.getFileLink(fileId) 20 | } catch (e) { 21 | if (e.code === 400) { 22 | await ctx.reply(ctx.i18n.t('fileTooBig')) 23 | } else { 24 | d('err')(e) 25 | await ctx.reply(ctx.i18n.t('unknownError')) 26 | } 27 | return 28 | } 29 | const ext = util.ext(fileUrl) 30 | const formats = await cloudconvert.listPossibleConversions(ext) 31 | 32 | let msg 33 | if (formats.length > 0) { 34 | // group formats by category 35 | const categories = formats.map(f => f.group).filter(uniques) 36 | msg = 37 | ctx.i18n.t('listFormats', { filetype: ext }) + 38 | '\n' + 39 | categories 40 | .map( 41 | cat => 42 | '' + 43 | cat + 44 | '\n' + 45 | formats 46 | .filter(f => f.group === cat) 47 | .map( 48 | f => 49 | '/' + 50 | f.outputformat.replace(/[\s.]/g, '_') + 51 | ' (' + 52 | f.outputformat + 53 | ')' 54 | ) 55 | .join('\n') 56 | ) 57 | .join('\n\n') 58 | } else { 59 | msg = 'I cannot convert files of type ' + ext + '! Sorry!' 60 | } 61 | 62 | const extra: ExtraReplyMessage = { 63 | // eslint-disable-next-line @typescript-eslint/camelcase 64 | reply_markup: cancelOperationReplyMarkup(ctx), 65 | } 66 | if (ctx.message !== undefined && ctx.message.chat.type !== 'private') { 67 | // eslint-disable-next-line @typescript-eslint/camelcase 68 | extra.reply_to_message_id = ctx.message.message_id 69 | } 70 | await ctx.replyWithHTML(msg, extra) 71 | } 72 | 73 | export async function getFileIdFromReply( 74 | ctx: TaskContext, 75 | usageHelp?: string 76 | ): Promise<{ file_id: string; file_name?: string } | undefined> { 77 | if (ctx.message !== undefined) { 78 | if (ctx.message.reply_to_message === undefined) { 79 | if (usageHelp) { 80 | await ctx.reply(usageHelp, { 81 | // eslint-disable-next-line @typescript-eslint/camelcase 82 | reply_to_message_id: ctx.message.message_id, 83 | }) 84 | } 85 | } else { 86 | const reply = ctx.message.reply_to_message 87 | let file: { file_id: string; file_name?: string } | undefined = 88 | reply.audio || 89 | reply.document || 90 | reply.sticker || 91 | reply.video || 92 | reply.voice || 93 | reply.video_note 94 | if (file === undefined && reply.photo !== undefined) { 95 | file = reply.photo[reply.photo.length - 1] 96 | } 97 | if (file === undefined) { 98 | if (usageHelp) { 99 | await ctx.reply(usageHelp, { 100 | // eslint-disable-next-line @typescript-eslint/camelcase 101 | reply_to_message_id: ctx.message.message_id, 102 | }) 103 | } 104 | } else { 105 | return file 106 | } 107 | } 108 | } 109 | return undefined 110 | } 111 | -------------------------------------------------------------------------------- /src/types/cloudconvert/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'cloudconvert' { 2 | import { ReadStream, WriteStream } from 'fs' 3 | 4 | export default class Api { 5 | constructor(apiKey: string) 6 | /** 7 | * createProcess 8 | */ 9 | public createProcess: ( 10 | parameters: ProcessCreateParamters, 11 | callback?: ProcessCallback 12 | ) => Process 13 | public convert: ( 14 | parameters: ProcessStartParameters, 15 | callback?: ProcessCallback 16 | ) => Process 17 | } 18 | export class Process { 19 | data: ProcessData 20 | constructor(api: Api, url?: string) 21 | create: ( 22 | parameters: ProcessCreateParamters, 23 | callback?: ProcessCallback 24 | ) => this 25 | start: ( 26 | parameters: ProcessStartParameters, 27 | callback?: ProcessCallback 28 | ) => this 29 | refresh: (parameters?: void, callback?: ProcessCallback) => this 30 | upload: ( 31 | source: ReadStream, 32 | filename?: string, 33 | callback?: ProcessCallback 34 | ) => this 35 | wait: (callback?: ProcessCallback, interval?: number) => this 36 | delete: (parameters?: void, callback?: ProcessCallback) => this 37 | download: ( 38 | destination: WriteStream, 39 | remotefile?: string, 40 | callback?: ProcessCallback, 41 | pipeoptions?: { end?: boolean } 42 | ) => this 43 | pipe: ( 44 | destination: WriteStream, 45 | options?: { end?: boolean } 46 | ) => WriteStream 47 | downloadAll: (outputpath: string, callback: ProcessCallback) => this 48 | } 49 | 50 | export interface ProcessData { 51 | id?: string 52 | url?: string 53 | percent?: number 54 | message?: string 55 | step?: Step 56 | starttime?: number 57 | expire?: number 58 | input?: any 59 | converter?: any 60 | info?: any 61 | } 62 | export type Step = 63 | | 'input' 64 | | 'wait' 65 | | 'convert' 66 | | 'output' 67 | | 'error' 68 | | 'finished' 69 | 70 | export interface ProcessCreateParamters { 71 | inputformat: string 72 | outputformat: string 73 | mode?: Mode 74 | } 75 | 76 | export type ProcessStartParameters = InputParameters & 77 | ConversionParameters & 78 | OutputParameters 79 | 80 | export interface InputDownload { 81 | input: 'download' 82 | file: string 83 | } 84 | export interface InputUpload { 85 | input: 'upload' 86 | } 87 | export interface InputRawBase64 { 88 | input: 'raw' | 'base64' 89 | file: string 90 | filename: string 91 | } 92 | export interface InputCloud { 93 | input: { 94 | // TODO: specify input types 95 | s3?: any 96 | openstack?: any 97 | azurefile?: any 98 | googlecloud?: any 99 | ftp?: any 100 | } 101 | file: string 102 | outputformat: string 103 | output: { 104 | // TODO: specify output types 105 | s3?: any 106 | openstack?: any 107 | azurefile?: any 108 | googlecloud?: any 109 | ftp?: any 110 | } 111 | } 112 | export type InputParameters = 113 | | InputDownload 114 | | InputUpload 115 | | InputRawBase64 116 | | InputCloud 117 | 118 | export interface ConversionParameters { 119 | outputformat?: string 120 | converteroptions?: any // TODO: specify possible values 121 | mode?: Mode 122 | timeout?: number 123 | } 124 | 125 | export interface OutputParameters { 126 | email?: boolean 127 | output?: Storage 128 | callback?: string 129 | wait?: boolean 130 | download?: boolean 131 | save?: boolean 132 | } 133 | 134 | export type Storage = 135 | | 'dropbox' 136 | | 'googledrive' 137 | | 's3' 138 | | 'openstack' 139 | | 'azure' 140 | | 'googlecloud' 141 | | 'ftp' 142 | export type Mode = 'convert' | 'info' | 'combine' | 'archive' | 'extract' 143 | 144 | export type ProcessCallback = (err: Error, process: Process) => any 145 | } 146 | -------------------------------------------------------------------------------- /src/bot/bot.ts: -------------------------------------------------------------------------------- 1 | import { Firestore } from '@google-cloud/firestore' 2 | import d from 'debug' 3 | import express from 'express' 4 | import path from 'path' 5 | import Telegraf from 'telegraf' 6 | import TelegrafI18n, { I18n } from 'telegraf-i18n' 7 | import firestoreSession from 'telegraf-session-firestore' 8 | import { User } from 'telegraf/typings/telegram-types' 9 | import * as apiKeys from './controllers/apikey-controller' 10 | import * as callbacks from './controllers/callback-controller' 11 | import * as commands from './controllers/command-controller' 12 | import * as fallbacks from './controllers/fallback-controller' 13 | import * as files from './controllers/file-controller' 14 | import * as groups from './controllers/group-controller' 15 | import commandArgs from './middlewares/command-args' 16 | import TaskContext from './models/task-context' 17 | const debug = d('bot:main') 18 | 19 | // ID of the dev's dedicated debug log channel 20 | const adminId = process.env.ADMIN_ID 21 | 22 | export interface BotInfo extends User { 23 | isDevBot: boolean 24 | } 25 | 26 | export default class Bot { 27 | private bot: Telegraf 28 | 29 | public constructor() { 30 | // Init bot with bot token 31 | const token = process.env.BOT_API_TOKEN 32 | if (token === undefined) { 33 | throw new Error( 34 | 'No API token provided in environ var BOT_API_TOKEN!' 35 | ) 36 | } 37 | this.bot = new Telegraf(token, { telegram: { webhookReply: false } }) 38 | 39 | // Make session data available 40 | const db = new Firestore({ 41 | projectId: 'cloudconvert-bot-257814', 42 | keyFilename: 'firestore-keyfile.json', 43 | }) 44 | this.bot.use( 45 | firestoreSession(db.collection('sessions'), { 46 | getSessionKey: (ctx: TaskContext) => ctx.chat?.id.toString(), 47 | // TODO: make telegraf-i18n support lazy mode 48 | }) 49 | ) 50 | 51 | // Make DB available directly 52 | this.bot.context.db = db 53 | 54 | // Make internationalization available 55 | const i18n = new TelegrafI18n({ 56 | defaultLanguage: 'en', 57 | useSession: true, 58 | sessionName: 'session', 59 | defaultLanguageOnMissing: true, 60 | directory: path.resolve(__dirname, 'locales'), 61 | }) 62 | this.bot.use(i18n.middleware()) 63 | 64 | const supportedLanguages = i18n 65 | .availableLocales() 66 | .sort() 67 | .map(l => ({ 68 | locale: l, 69 | name: ((i18n.createContext(l, {}) as unknown) as I18n).t( 70 | 'languageName' 71 | ), 72 | })) 73 | this.bot.context.supportedLanguages = supportedLanguages 74 | 75 | // Make arg parsing available 76 | this.bot.use(commandArgs()) 77 | 78 | debug('Available locales are', i18n.availableLocales()) 79 | debug('Bot initialized.') 80 | } 81 | 82 | public async start(): Promise { 83 | const me = await this.bot.telegram.getMe() 84 | const username = me.username || '' 85 | const isDevBot = username.includes('dev') 86 | this.bot.context.botInfo = { 87 | ...me, 88 | isDevBot, 89 | } 90 | 91 | this.bot.options.username = username 92 | // Listeners (esp. for commands) can only be registered now that the bot name is known 93 | this.registerListeners() 94 | 95 | if (isDevBot) { 96 | await this.bot.telegram.deleteWebhook() 97 | this.bot.startPolling() 98 | debug( 99 | 'Bot @' + 100 | username + 101 | ' started using long polling at ' + 102 | new Date() 103 | ) 104 | } else { 105 | const port = process.env.PORT || 8080 106 | const url = 107 | 'https://cloudconvert-bot-257814.appspot.com:443/' + 108 | this.bot.token 109 | const app = express() 110 | app.use(this.bot.webhookCallback('/' + this.bot.token)) 111 | app.listen(port) 112 | await this.bot.telegram.setWebhook(url) 113 | debug( 114 | 'Bot @' + 115 | username + 116 | ' started using a webhook at ' + 117 | new Date() + 118 | ' for URL ' + 119 | url 120 | ) 121 | } 122 | } 123 | 124 | private registerListeners(): void { 125 | // Group support 126 | this.bot.on(['new_chat_members'], groups.addedToGroup) 127 | this.bot.on(['left_chat_member'], groups.removedFromGroup) 128 | 129 | // Special handling for photos as they don't simply have a file_id 130 | this.bot.on(['photo'], files.handlePhoto) 131 | 132 | // Files 133 | this.bot.on( 134 | ['audio', 'document', 'sticker', 'video', 'voice', 'video_note'], 135 | files.handleDocument 136 | ) 137 | 138 | // Commands 139 | this.bot.command('start', commands.start) 140 | this.bot.command('help', commands.help) 141 | this.bot.command('cancel', commands.cancel) 142 | this.bot.command('reset', commands.reset) 143 | this.bot.command('balance', commands.balance) 144 | this.bot.command( 145 | ['contribute', 'the_more_the_merrier'], 146 | commands.contribute 147 | ) 148 | this.bot.command('feedback', commands.feedback) 149 | this.bot.command('limitations', commands.limitations) 150 | this.bot.command('apikey', commands.apiKey) 151 | this.bot.command('language', commands.language) 152 | this.bot.command('info', commands.info) 153 | this.bot.command('convert', commands.convert) 154 | 155 | // Text messages are used for every file format command (like /mp4) and when providing an API key 156 | this.bot.on( 157 | ['text'], 158 | files.handleTextMessage, 159 | apiKeys.handleTextMessage, 160 | fallbacks.help 161 | ) 162 | 163 | // Respond to callback queries 164 | this.bot.on('callback_query', callbacks.handleCallbackQuery) 165 | 166 | // Log all errors to dedicated channel 167 | this.bot.catch((err: any, ctx: TaskContext) => this.report(err, ctx)) 168 | } 169 | 170 | private report(err: any, ctx: TaskContext): void { 171 | if (adminId !== undefined) { 172 | // <- the dev's debug log channel id 173 | const log = 174 | 'Error:\n' + 175 | JSON.stringify(err, null, 2) + 176 | '\n\nContext:\n' + 177 | JSON.stringify( 178 | { ...ctx.message, ...ctx.session, ...ctx.command }, 179 | null, 180 | 2 181 | ) + 182 | '\n\nTrace:\n' + 183 | (err?.stack === undefined ? new Error() : err).stack 184 | this.bot.telegram.sendMessage(adminId, log) 185 | if (this.bot.context.botInfo.isDevBot) { 186 | debug(log) 187 | } 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /src/bot/models/cloud-convert.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import CloudConvert, { Process, ProcessData } from 'cloudconvert' 3 | import d from 'debug' 4 | import { 5 | Array, 6 | Literal, 7 | Null, 8 | Number, 9 | Record, 10 | Static, 11 | String, 12 | Undefined, 13 | Union, 14 | } from 'runtypes' 15 | import * as util from '../helpers/get-file-extension' 16 | import TaskContext from './task-context' 17 | import { PassThroughStream } from './pass-through-stream' 18 | const debug = d('bot:converter') 19 | 20 | const UserType = Record({ 21 | user: Union(String, Null), // Null iff shared account (that's the dev's personal account) 22 | minutes: Number, 23 | output: Array( 24 | Union( 25 | Literal('googledrive'), 26 | Literal('dropbox'), 27 | Literal('box'), 28 | Literal('onedrive') 29 | ) 30 | ).Or(Undefined), 31 | }) 32 | type User = Static 33 | 34 | const FormatType = Record({ 35 | inputformat: String, 36 | outputformat: String, 37 | group: String, 38 | }) 39 | type Format = Static 40 | 41 | const REFRESH_INTERVAL = 100 // ms 42 | 43 | if (process.env.CLOUD_CONVERT_API_TOKEN === undefined) { 44 | throw new Error( 45 | 'Please provide a cloudconvert API token in the environment variable CLOUD_CONVERT_API_TOKEN!' 46 | ) 47 | } 48 | const ccDefault = new CloudConvert(process.env.CLOUD_CONVERT_API_TOKEN) 49 | 50 | async function getDefaultUser(): Promise { 51 | const response = await axios.get( 52 | 'https://api.cloudconvert.com/v1/user?apikey=' + 53 | process.env.CLOUD_CONVERT_API_TOKEN 54 | ) 55 | const defaultUser = UserType.check(response.data) 56 | return { 57 | user: null, 58 | minutes: defaultUser.minutes, 59 | output: [], 60 | } 61 | } 62 | 63 | async function getNonDefaultUser(key: string): Promise { 64 | try { 65 | debug('Performing request') 66 | const response = await axios.get( 67 | 'https://api.cloudconvert.com/v1/user?apikey=' + key 68 | ) 69 | debug('Response is:') 70 | debug(response.data) 71 | return UserType.check(response.data) 72 | } catch (e) { 73 | d('err')(e) 74 | return undefined 75 | } 76 | } 77 | 78 | export async function validateApiKey(key: string): Promise { 79 | debug('Getting non-default user') 80 | const user = await getNonDefaultUser(key) 81 | // Three options: invalid valid shared key 82 | return user === undefined ? undefined : user.user || undefined 83 | } 84 | 85 | /** 86 | * Returns a User object for the given API key of a cloud convert account. 87 | * If no key is given, the default account is used. If the key is invalid, 88 | * another request will be performed and the default account's balance will be returned instead. 89 | */ 90 | async function getUser(key?: string): Promise { 91 | return key === undefined 92 | ? await getDefaultUser() 93 | : (await getNonDefaultUser(key)) || (await getDefaultUser()) 94 | } 95 | 96 | /** 97 | * Return the number of conversion minutes for the account as specified by getUser. 98 | * @param key cloud convert account API key 99 | */ 100 | export async function getBalance(key?: string): Promise { 101 | const user = await getUser(key) 102 | return user.minutes 103 | } 104 | 105 | function getCloudConvert(key?: string): CloudConvert { 106 | return key === undefined ? ccDefault : new CloudConvert(key) 107 | } 108 | 109 | // The following functions are so freaking ugly. 110 | // TODO: Upgrade to cloudconvert v2 once it's stable 111 | // https://cloudconvert.com/blog/api-v2 112 | 113 | // We cannot use `util.promisify` due to the missing context. 114 | // Use this helper function (instead of adding bluebird as a dependency). 115 | function promiseResolver( 116 | resolve: (value?: T | PromiseLike | undefined) => void, 117 | reject: (reason?: any) => void 118 | ): (err: Error, t: T) => void { 119 | return (err: Error, t: T) => { 120 | if (err) { 121 | reject(err) 122 | } else { 123 | resolve(t) 124 | } 125 | } 126 | } 127 | 128 | export async function getFileInfo( 129 | fileUrl: string, 130 | key?: string 131 | ): Promise { 132 | const ext = util.ext(fileUrl) 133 | const cc = getCloudConvert(key) 134 | 135 | let p: Process = await new Promise((resolve, reject) => { 136 | cc.createProcess( 137 | { 138 | inputformat: ext, 139 | outputformat: ext, 140 | mode: 'info', 141 | }, 142 | promiseResolver(resolve, reject) 143 | ) 144 | }) 145 | p = await new Promise((resolve, reject) => { 146 | p.start( 147 | { 148 | input: 'download', 149 | file: fileUrl, 150 | mode: 'info', 151 | }, 152 | promiseResolver(resolve, reject) 153 | ) 154 | }) 155 | const result: any = await new Promise((resolve, reject) => { 156 | p.wait(promiseResolver(resolve, reject), REFRESH_INTERVAL) 157 | }) 158 | return result === undefined ? undefined : result.data 159 | } 160 | 161 | export async function listPossibleConversions(ext: string): Promise { 162 | const response = await axios.get( 163 | 'https://api.cloudconvert.com/conversiontypes?inputformat=' + ext 164 | ) 165 | return Array(FormatType).check(response.data) 166 | } 167 | 168 | export async function convertFile( 169 | fileUrl: string, 170 | outputformat: string, 171 | fileName: string, 172 | key?: string 173 | ): Promise { 174 | const inputformat = util.ext(fileUrl) 175 | const cc = getCloudConvert(key) 176 | 177 | let p: Process = await new Promise((resolve, reject) => { 178 | cc.createProcess( 179 | { 180 | inputformat, 181 | outputformat, 182 | }, 183 | promiseResolver(resolve, reject) 184 | ) 185 | }) 186 | p = await new Promise((resolve, reject) => { 187 | p.start( 188 | { 189 | input: 'download', 190 | file: fileUrl, 191 | outputformat, 192 | }, 193 | promiseResolver(resolve, reject) 194 | ) 195 | }) 196 | p = await new Promise((resolve, reject) => { 197 | // The following line is one of the reasons why using the cloudconvert api 198 | // is so ugly in v1. The callback is not the last parameter. This is against 199 | // the convention. As a result, we cannot promisify the function. 200 | // Instead, we have to use this weird way to wrap all functions 201 | // in order to be able to use some proper async/await. Thanks. 202 | p.wait(promiseResolver(resolve, reject), REFRESH_INTERVAL) 203 | }) 204 | 205 | const stream = new PassThroughStream(fileName) 206 | p.download(stream) 207 | stream.on('finish', () => { 208 | p.delete() 209 | }) 210 | return stream 211 | } 212 | 213 | export function describeErrorCode( 214 | ctx: TaskContext, 215 | err: Error & { code: number } 216 | ): string { 217 | debug(err) 218 | switch (err.code) { 219 | case 400: 220 | return err.message 221 | case 402: 222 | return ctx.i18n.t('noMoreConversionMinutes') 223 | default: 224 | if (err.message) { 225 | return err.message 226 | } else { 227 | d('err')("ERROR'S STACK AND CURRENT STACK:") 228 | d('err')(err.stack) 229 | d('err')(new Error().stack) 230 | return ctx.i18n.t('unknownError') 231 | } 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /src/bot/controllers/command-controller.ts: -------------------------------------------------------------------------------- 1 | import { ProcessData } from 'cloudconvert' 2 | import d from 'debug' 3 | import treeify from 'treeify' 4 | import * as htmlUtils from '../helpers/html-escaper' 5 | import { selectLanguageReplyMarkup } from '../helpers/reply-markup-builder' 6 | import * as cloudconvert from '../models/cloud-convert' 7 | import TaskContext from '../models/task-context' 8 | import * as controllerUtils from './apikey-controller' 9 | import * as utils from './controller-utils' 10 | import * as files from './file-controller' 11 | const debug = d('bot:contr:command') 12 | 13 | // We always check the ctx.command property because it does better filtering, 14 | // i.e. it is only set if the command is actually meant for us (our middleware does this) 15 | 16 | export async function start(ctx: TaskContext): Promise { 17 | if (ctx.chat !== undefined && ctx.command?.command === 'start') { 18 | debug('/start') 19 | const response = 20 | ctx.chat.type === 'private' 21 | ? ctx.i18n.t('helpmsgStartPrivate') 22 | : ctx.i18n.t('helpmsgStartGroups') 23 | await ctx.replyWithHTML(response) 24 | await ctx.db.collection('userstats').doc(ctx.chat.id.toString()).set({ 25 | type: ctx.chat.type, 26 | }) 27 | } 28 | } 29 | 30 | export async function help(ctx: TaskContext): Promise { 31 | debug('/help') 32 | if (ctx.chat !== undefined && ctx.command?.command === 'help') { 33 | const response = 34 | ctx.chat.type === 'private' 35 | ? ctx.i18n.t('helpmsgPrivate') 36 | : ctx.i18n.t('helpmsgGroups') 37 | await ctx.replyWithHTML(response) 38 | } 39 | } 40 | 41 | export async function reset(ctx: TaskContext): Promise { 42 | debug('/reset') 43 | if (ctx.chat !== undefined && ctx.command?.command === 'reset') { 44 | ctx.session = {} 45 | await ctx.reply(ctx.i18n.t('reset')) 46 | } 47 | } 48 | 49 | export async function cancel(ctx: TaskContext): Promise { 50 | debug('/cancel') 51 | if (ctx.chat !== undefined && ctx.command?.command === 'cancel') { 52 | delete (await ctx.session).task 53 | await ctx.reply(ctx.i18n.t('operationCancelled')) 54 | } 55 | } 56 | 57 | export async function balance(ctx: TaskContext): Promise { 58 | debug('/balance') 59 | if (ctx.chat !== undefined && ctx.command?.command === 'balance') { 60 | const minutes = await cloudconvert.getBalance( 61 | (await ctx.session).api_key 62 | ) 63 | await ctx.replyWithHTML( 64 | ctx.i18n.t('remainingConversions') + 65 | ': ' + 66 | minutes + 67 | '\n\n' + 68 | ctx.i18n.t('customApiKeyInstruction') 69 | ) 70 | } 71 | } 72 | 73 | export async function contribute(ctx: TaskContext): Promise { 74 | debug('/contribute') 75 | if ( 76 | ctx.chat !== undefined && 77 | (ctx.command?.command === 'contribute' || 78 | ctx.command?.command === 'the_more_the_merrier') 79 | ) { 80 | const session = await ctx.session 81 | const response = 82 | session.api_key === undefined 83 | ? ctx.i18n.t('helpmsgSetUpAccount') 84 | : ctx.i18n.t('helpmsgBalanceWithApiKey') + 85 | '\n
' +
 86 |                   session.api_key +
 87 |                   '
\n\n' + 88 | ctx.i18n.t('helpmsgBuyMinutes') 89 | await ctx.replyWithHTML(response) 90 | } 91 | } 92 | 93 | export async function feedback(ctx: TaskContext): Promise { 94 | debug('/feedback') 95 | if (ctx.command?.command === 'feedback') { 96 | await ctx.replyWithHTML(ctx.i18n.t('helpmsgFeedback')) 97 | } 98 | } 99 | 100 | export async function limitations(ctx: TaskContext): Promise { 101 | debug('/limitations') 102 | if (ctx.command?.command === 'limitations') { 103 | await ctx.replyWithHTML(ctx.i18n.t('helpmsgLimitations')) 104 | } 105 | } 106 | 107 | export async function apiKey(ctx: TaskContext): Promise { 108 | debug('/apikey') 109 | if (ctx.message !== undefined && ctx.command?.command === 'apikey') { 110 | if (ctx.command?.args?.[0] !== undefined) { 111 | const key = ctx.command.args[0] 112 | await controllerUtils.receivedApiKey(ctx, key) 113 | } else { 114 | await ctx.replyWithHTML(ctx.i18n.t('sendApiKey'), { 115 | // eslint-disable-next-line @typescript-eslint/camelcase 116 | reply_to_message_id: ctx.message.message_id, 117 | // eslint-disable-next-line @typescript-eslint/camelcase 118 | reply_markup: { force_reply: true, selective: true }, 119 | }) 120 | } 121 | } 122 | } 123 | 124 | export async function language(ctx: TaskContext): Promise { 125 | debug('/language') 126 | if (ctx.message !== undefined && ctx.command?.command === 'language') { 127 | await ctx.replyWithHTML(ctx.i18n.t('pickLanguage'), { 128 | // eslint-disable-next-line @typescript-eslint/camelcase 129 | reply_markup: selectLanguageReplyMarkup(ctx), 130 | // eslint-disable-next-line @typescript-eslint/camelcase 131 | disable_web_page_preview: true, 132 | }) 133 | } 134 | } 135 | 136 | export async function info(ctx: TaskContext): Promise { 137 | debug('/info') 138 | if (ctx.command?.command === 'info') { 139 | const file = await utils.getFileIdFromReply( 140 | ctx, 141 | ctx.i18n.t('helpmsgInfo') 142 | ) 143 | if (ctx.message !== undefined && file !== undefined) { 144 | let fileInfo: ProcessData | undefined 145 | let url: string 146 | try { 147 | url = await ctx.telegram.getFileLink(file.file_id) 148 | } catch (e) { 149 | if (e.code === 400) { 150 | await ctx.reply(ctx.i18n.t('fileTooBig')) 151 | } else { 152 | d('err')(e) 153 | await ctx.reply(ctx.i18n.t('unknownError')) 154 | } 155 | return 156 | } 157 | try { 158 | fileInfo = await cloudconvert.getFileInfo( 159 | url, 160 | (await ctx.session).api_key 161 | ) 162 | } catch (e) { 163 | if (e.code === undefined || typeof e.code !== 'number') { 164 | d('err')(e) 165 | await ctx.reply(ctx.i18n.t('unknownError')) 166 | } else { 167 | await ctx.reply(cloudconvert.describeErrorCode(ctx, e)) 168 | } 169 | return 170 | } 171 | 172 | let msg: string 173 | if (fileInfo?.info !== undefined) { 174 | const tree = treeify.asTree(fileInfo.info, true, true) 175 | // WHY THE FUCK ARE THERE NULL CHARACTERS IN THIS STRING?! 176 | const clean = tree.replace(/\0/g, '') 177 | const escaped = htmlUtils.escapeHtmlTags(clean) 178 | msg = ctx.i18n.t('fileInfo') + '\n
' + escaped + '
' 179 | } else { 180 | msg = ctx.i18n.t('noFileInfo') 181 | } 182 | 183 | await ctx.replyWithHTML(msg, { 184 | // eslint-disable-next-line @typescript-eslint/camelcase 185 | reply_to_message_id: ctx.message.message_id, 186 | }) 187 | } 188 | } 189 | } 190 | 191 | export async function convert(ctx: TaskContext): Promise { 192 | debug('/convert') 193 | if (ctx.command?.command === 'convert') { 194 | const file = await utils.getFileIdFromReply( 195 | ctx, 196 | ctx.i18n.t('helpmsgConvert') 197 | ) 198 | if (file !== undefined) { 199 | await files.setSourceFile(ctx, file.file_id) 200 | } 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cloudconvert-bot 2 | 3 | This Telegram bot ([@cloud_convert_bot](https://t.me/cloud_convert_bot)) mediates between the Telegram servers and those of cloudconvert.com to provide file conversions in Telegram. 4 | It also relies on a Cloud Firestore database. 5 | The code runs on GAE. 6 | 7 | ## Translations 8 | 9 | The bot can be translated on the website [POEditor](https://poeditor.com/join/project/rBNUMw67kZ). 10 | All contributions are welcome. 11 | Feel free to add your own language if you like. 12 | 13 | ## Installation 14 | 15 | Make sure you have [Node.js](https://nodejs.org) installed. The package manager `npm` comes with it. 16 | 17 | Then open a terminal in the root directory of this repository and run 18 | 19 | ```bash 20 | npm install 21 | ``` 22 | 23 | to install all necessary dependencies for this project. 24 | 25 | ## Building 26 | 27 | The [TypeScript](https://typescriptlang.org) compiler is used to build this project. 28 | It can be invoked using 29 | 30 | ```bash 31 | npm run build 32 | ``` 33 | 34 | ## Lint 35 | 36 | This project enforces linting rules using [ESLint](https://eslint.org/). 37 | Simply run 38 | 39 | ```bash 40 | npm run lint 41 | ``` 42 | 43 | to make sure everything in the code looks pretty. 44 | 45 | ## Running in production 46 | 47 | The command 48 | 49 | ```bash 50 | npm start 51 | ``` 52 | 53 | runs the project after it was built. 54 | Only a few logs are emitted, among them are error logs. 55 | 56 | This is the command GAE will run when you deploy the project later on. 57 | 58 | ## Running with all logs 59 | 60 | Execute 61 | 62 | ```bash 63 | npm run debug 64 | ``` 65 | 66 | to run the built project with all logs. 67 | This is nice for debugging. 68 | 69 | ## Deployment 70 | 71 | ### Initial setup 72 | 73 | #### App Engine 74 | 75 | This project runs on GCP, the [Google Cloud Platform](https://cloud.google.com). 76 | It (ab)uses an App Engine Frontend instance with autoscaling fixed to 1 because that's included in the free plan. 77 | As stated above, all data is stored in a Cloud Firestore database. 78 | 79 | First, you need to 80 | 81 | 1) [create a GCP project](https://cloud.google.com/resource-manager/docs/creating-managing-projects), 82 | 1) [set up your development environment](https://cloud.google.com/appengine/docs/standard/nodejs/setting-up-environment), and 83 | 1) [prepare your project for App Engine usage](https://cloud.google.com/appengine/docs/standard/nodejs/console). 84 | 85 | The last step includes enabling your project for billing. 86 | Note that the deployment of this bot is completely free as long as the bot's traffic stays within the [free quota](https://cloud.google.com/free) of GCP. 87 | 88 | #### Database 89 | 90 | You need to create a Firestore database, obtain a keyfile containing credentials and save that file in the root folder of this repository. 91 | The name of the keyfile should be `firestore-keyfile.json` because that name is excluded in `.gitignore`. 92 | 93 | You can just follow two sections from the a tutorial page, namely those: 94 | 95 | 1) [Creating a Cloud Firestore database](https://cloud.google.com/firestore/docs/quickstart-servers#create_a_in_native_mode_database) 96 | 1) [Setting up authentication](https://cloud.google.com/firestore/docs/quickstart-servers#set_up_authentication) 97 | 98 | #### Tokens and environment variables 99 | 100 | Create a file called `.env` in the root directory of this repository. 101 | It will contain all of the variables that the bot will pick up automatically when it starts. 102 | 103 | Use the format 104 | 105 | ```bash 106 | VARIABLE_NAME=variable-value 107 | ``` 108 | 109 | inside the `.env` file. 110 | 111 | Three environment variables need to be set for this bot to work. 112 | 113 | 1) You need to create a bot using [@BotFather](https://telegram.me/BotFather) and write its token to a variable named `BOT_API_TOKEN` 114 | 1) You need to supply your personal CloudConvert account as a backup account for the bot. 115 | All users of your bot will share the conversion minutes from that account until they submit their own API key. 116 | Add the API key of your personal account to a variable called `CLOUD_CONVERT_API_TOKEN`. 117 | 1) **Optional.** 118 | The bot is able to send error logs to a chat on Telegram, for example a private channel that contains the debug log. 119 | Set the ID of this chat in a variable with the name `ADMIN_ID`. 120 | 121 | It usually makes sense to create two bots using [@BotFather](https://t.me/BotFather), one for production and one for development. 122 | 123 | This bot runs with webhooks but it will automatically switch to long polling mode if 'dev' is contained in the bot name. 124 | (E. g. the primary test bot is [@cloud_convert_dev_bot](https://t.me/cloud_convert_dev_bot).) 125 | This way, you can host the bot efficiently (webhooks) and still use it locally (long polling). 126 | 127 | As of today, you need to change the bot token in the `.env` file in order to switch between different bots. 128 | I know it would be much nicer to control this via environment variable … hopefully this will be improved in the future. 129 | 130 | Note that the `.gitignore` file contains not only the `.env` file name but also an entry for `.env.production`. 131 | This naming is a bit misleading, but again, it might be improved in the future. 132 | As of today, the `.env.production` file will be completely ignored in all cases by the bot. 133 | However, you can use it to store a second set of credentials. 134 | You can now exchange the files to switch between the bots. 135 | In other words, have your development bot token (and everything else) in one `.env` file and have your production bot token in `.env.production`. 136 | Once you want to deploy, exchange both files. 137 | 138 | ### Roll out new version 139 | 140 | After performing the initial setup, you can easily deploy a new production version of the currently checked out source code by running 141 | 142 | ```bash 143 | gcloud app deploy 144 | ``` 145 | 146 | ## Software architecture 147 | 148 | The bots uses [Telegraf.js](https://telegraf.js.org) as the framework for the bot. 149 | Make sure you understand how the framework is used, including how middleware works. 150 | 151 | ### Which code does what 152 | 153 | Basically, in `src/app.ts`, we start the bot which is in `src/bot/bot.ts`. 154 | It loads all sorts of middleware from the controllers in `src/bot/controllers` to handle the various different kinds of messages. 155 | The controllers do IO (database and replying) and control models in `src/bot/models`. 156 | The models do the actual file conversions and generally the communication with cloudconvert.com. 157 | The packages `src/bot/{helpers,middlewares}` are of supportive nature and only provide various utilities. 158 | 159 | ### How and which data is stored 160 | 161 | Each chat has a session state. 162 | Think of it like an object that contains everything the bot remembers about this chat. 163 | Session middleware handles the loading and storing of that data for us. 164 | The shape of the session state—including all available fields—is defined in the `SessionData` interface in `src/bot/models/task-context.ts`. 165 | 166 | The session data can be used to store partial information about the task we need to perform, such as when only a file was received but the target format is yet to be determined by the user. 167 | 168 | In addition, the bot collects a log of successfull conversions in a separate collection. 169 | This includes the chat ID, source and target format, timestamp, and a boolean indicating if the conversion was triggered automatically using auto-conversions. 170 | 171 | A third log collection saves the chat type for each seen chat ID. 172 | 173 | Both logs are never queried and may be emptied at any time. 174 | 175 | No files are ever stored permanently by the bot. 176 | 177 | ### How are files processed 178 | 179 | Assume we know a user ID, a file ID and a target format. 180 | We can now perform a file conversion by converting the file to the target format using the user's API key (or the default one if not applicable). 181 | We use this API key for all following communication with cloudconvert.com. 182 | 183 | The conversion works as follows: 184 | 185 | 1) Get the link to the file of our file ID. 186 | 1) Make cloudconvert.com pull the file directly from Telegram servers and supply the target format along the link. 187 | 1) Wait until the conversion is performed. 188 | 1) Download the file from cloudconvert.com and immediately send the file to the Telegram servers to the known chat as soon as the next chunk of the file is available (passthrough streaming the file). 189 | 1) Delete the file from the servers at cloudconvert.com so they don't pollute the dashboard. 190 | (This would be done automatically after 24 hours if we didn't take action.) 191 | 192 | ## What else is there to say 193 | 194 | There's not too much documentation, but the project is not too complicated anyway IMO. 195 | If you have questions regarding anything, contact [me](https://t.me/KnorpelSenf) or join the [discussion group](https://t.me/cloud_convert_bot_lounge). 196 | There's also a [news channel](https://t.me/cloud_convert_bot_news). 197 | -------------------------------------------------------------------------------- /src/bot/locales/ar-ye.json: -------------------------------------------------------------------------------- 1 | { 2 | "helpmsgStartPrivate": " مرحبًا! يمكنني مساعدتك في تحويل الملفات! من فضلك أرسل لي ملفك للتحويل.\nللمساعده \n /help", 3 | "helpmsgPrivate": "مرحبا! أنا روبوت لتحويل الملفات. أنا أدعم 218 تنسيقًا مختلفًا للملفات وأعرف كيفية التعامل مع الوسائط من أي نوع ( ملفات صوتية ، و مستندات ، و ملفات ، و المتحرك ، و صور و ملصقات و مقاطع فيديو و ملاحظات صوتية و ملاحظات الفيديو ). هام: يمكنك تجربتي مجانًا. إذا كنت تريد تحويل ملف واحد فقط ، فما عليك سوى المضي قدمًا والقيام بذلك. ومع ذلك ، هذا الروبوت هو مشروع مجتمعي . إذا كنت تريد استخدام هذا الروبوت أكثر من مرة ، فالرجاء المساهمة من خلال توفير مفتاح API واجهة برمجة التطبيقات : راجع /contribute المساهمة. يستغرق هذا 30 ثانية فقط وهو بسيط للغاية. ستتم مكافأتك بـ 25 تحويل إضافي مجاني كل يوم. أنها تنطوي على إنشاء حساب. (لا تقلق ، فهو مجاني إلى الأبد. ) أنا أيضًا أدعم تحويلات الملفات التلقائية (حتى في الدردشات الجماعية)! قم بتمكين التحويلات التلقائية إذا كان لديك الكثير من الملفات من نفس النوع ليتم تحويلها. يمكنك تمكين التحويلات التلقائية بمجرد تحويل ملف. يمكنك ضبط اللغة باستخدام /language . تذكر أن هذا الروبوت لن يعمل بدون المساهمين العديدين - كن واحدًا منهم! المساهمة في مجموعة /contribute\n المناقشة : @cloud_convert_bot_ar\nقناة الأخبار: @cloud_convert_ar_bot\nمساعد بالترجمة والتطوير @al_hmirey", 4 | "helpmsgStartGroups": "\n مرحبًا! اسمي Cloud Convert Bot ويمكنني مساعدتك في تحويلات الملفات! اكتب\n /help ساعد في جولة سريعة ، واضبط لغتك مع /language اللغة - ولا تنس إعداد حسابك: /contribute", 5 | "helpmsgGroups": " مرحبًا! اسمي Cloud Convert Bot ويمكنني مساعدتك في تحويلات الملفات! لن أرسل لك أي رسائل أو أي ملفات محولة (إلا إذا طلبت ذلك جيدًا). هناك طريقتان لإخباري بضرورة تحويل ملف لك: 1) توجية على ملف يرسله شخص ما. قم بالرد بالتنسيق الهدف مباشرة (على سبيل المثال /mp4 ) أو قم بإرسال /convert تحويل لرؤية التنسيقات الممكنة. سأستخدم أحدث ملف إذا لم تضغط على الرد لأي رسالة. 2) أرسل تعليقًا عند إرسال الملف ، على سبيل المثال /mp4 للتحويل إلى MP4. بمجرد اكتمال التحويل ، يمكنك تمكين التحويلات التلقائية . إذا قمت بتمكين التحويلات التلقائية لنوع ملف ، فسأكرر هذا التحويل تلقائيًا لجميع الملفات من نفس النوع. الميزة الأكثر روعة هو أنه يمكنك إنشاء حسابك الخاص. يمكن أن يعمل هذا الروبوت لبعض الوقت بدون حساب ، ولكن إذا كنت تستخدم الروبوت بانتظام ، فإن إعداد حساب مهم حقًا لأنه يمكنك الحصول على المزيد من التحويلات المجانية من هذا القبيل. قم بإعداده مع /contribute ساهم. بهذه الطريقة ، يمكنك تجنب بعض /limitations القيود كما يمكنك المساهمة في هذا الروبوت (وهو أمر مفيد حقًا). لاحظ أن جميع الأوامر في هذه الدردشة الجماعية يجب أن تنتهي بـ \"cloud_convert_bot\" ، وإلا فسوف أتجاهلها (على سبيل المثال ، ليس /mp4 ولكن /mp4@cloud_convert_bot)!\n)! ", 6 | "helpmsgLimitations": "يوجد حاليًا حدين . أولاً: يمكنك تحويل بضعة ملفات فقط في اليوم. ثانيًا: يمكنك فقط تحويل الملفات بحجم معين. نظرًا لأن جميع مستخدمي هذا الروبوت يشتركون في مجموعة مشتركة من 25 تحويلًا يوميًا ويمكن للمستخدمين الآخرين استهلاك تحويلاتك (تحقق من الرصيد /balance الرصيد) ، لا يمكنك أحيانًا تحويل أي ملف على الإطلاق. الشيء الجيد هو: ما عليك سوى إعداد حساب و BOOM - لقد تم تجاوز هذا الحد! انظر /contribute في ذلك! لا يسمح Telegram للروبوتات (مثلي) بتنزيل ملفات يزيد حجمها عن 20 ميغابايت أو تحميل ملفات يزيد حجمها عن 50 ميغابايت. لا يمكن تغيير هذا الحد. إذا كنت بحاجة إلى تحويل ملفات أكبر ، فيمكنك زيارة cloudconvert.com. آسف!", 7 | "helpmsgSetUpAccount": "مرحبًا ، مساهم الروبوت في المستقبل! بالمساهمة ، يمكنك المطالبة بـ 25 تحويلًا إضافيًا مجانيًا في اليوم ! لن يتمكن أي شخص آخر من التأثير على هذا العداد. لن تضطر إلى دفع أي شيء مقابل هذا وهو يعمل بالكامل بدون السحر. كل ما عليك فعله هو اتباع هذه الخطوات الثلاث:\n 1) قم بإنشاء حساب Cloud Convert الخاص بك هنا . 2) انتقل إلى لوحة التحكم وانسخ مفتاح واجهة برمجة التطبيقات. 3) ارجع إلى هذه الدردشة وأرسل /apikey. الصق مفتاح API في هذه الدردشة. عمل جيد! الآن ستعمل كل عملية فردية لهذا الروبوت بناءً على حساب Cloud Convert الجديد الخاص بك! تؤدي إعادة تعيين الروبوت باستخدام امر /reset إعادة تعيين إلى مسح مفتاح API من قاعدة البيانات الخاصة بنا. بمجرد أن ترسل لي مفتاح API الخاص بك ، سأخبرك بأمر bot سري كهدية شكر! يرجى ملاحظة أنه هذا الروبوت ولا مطوره مرتبطين بأي شكل من الأشكال بـ cloudconvert.com. يقدم الأشخاص الذين يقفون وراء هذا الموقع تحويلات مجانية للملفات ولديهم طريقة رائعة لربط برامج الروبوت بتلك الخدمة. يوجد مقرهم في ميونيخ بألمانيا ولا داعي للقلق بشأن مخاوف الخصوصية أو الإعلانات أو هراء \"نحن نفتقدك\" بمجرد التسجيل. تذكر أن ربط حسابك الخاص بهذا الروبوت مهم جدًا لكي يعمل هذا الروبوت. \nقناة البوت العربية @cloud_convert_ar_bot", 8 | "helpmsgBalanceWithApiKey": "مرحباً بك! لقد قمت بتوصيل حساب Cloud Convert الشخصي الخاص بك بهذا الروبوت! شكرا جزيلا! يمكنك التحقق من رصيده بامر /balance . لقد قمت بتوصيل هذا الروبوت من خلال توفير مفتاح API التالي (شكرًاً)", 9 | "validatingApiKey": "جاري التحقق ..", 10 | "helpmsgBuyMinutes": "اذا كنت بحاجة إلى إجراء المزيد من التحويلات ، يمكنك شراء دقائق التحويل على www.cloudconvert.com. سيستخدمها هذا الروبوت تلقائيًا إذا كانت متوفرة. ومع ذلك ، يرجى تذكر أن هذا المشروع تم إنشاؤه بواسطة طالب واحد في جامعة صنعاء-اليمن. على الرغم من أنني بذلت قصارى جهدي للحفاظ على هذا البرنامج خاليًا من الأخطاء ويمكن الاعتماد عليه قدر الإمكان ، لا يمكنني ضمان أن هذا الروبوت لا يستهلك بطريق الخطأ كل دقائق التحويل ، مما يؤدي إلى استهلاك الرصيد أو ما شابه ذلك . لم يحدث ذلك أبدًا حتى الآن وأعتقد أنه من غير المحتمل جدًا ، لكنه لا يزال برنامجًا ، لذا فأنت لا تعرف أبدًا. إذا كنت تعرف TypeScript ، فيمكنك التحقق من شفرة المصدر للتحقق من أن شيئًا ما بهذا السوء لن يحدث أبدًا.\nالقناة العربية * @cloud_convert_ar_bot\nللمساعدة والاستفسار ", 11 | "autoConversionSaved": "تم الحفظ.", 12 | "remainingConversions": "التحويلات المتبقية.", 13 | "customApiKeyInstruction": "هل تحتاج للمزيد من التحويلات؟ اضغط /contribute\nاو تابع التعليمات بالقناة\n@cloud_convert_ar_bot", 14 | "helpmsgFeedback": "مثل هذا الروبوت؟ أخبر المطور KnorpelSenf@ @al_hmirey أو شارك أفكارك في مجموعة المناقشة \n@cloud_convert_bot_ar!\nأفضل طريقة للتعبير عن الشكر هي المساهمه با توفير مفتاح API. \n/contribute\nيمكنك أيضًا \nالمساعدة في ترجمة هذا الروبوت.", 15 | "sendApiKey": "في احسن الاحوال! أرسل لي الآن مفتاح API ردًا على هذه الرسالة!", 16 | "helpmsgInfo": "استخدم هذا الأمر للرد على ملف! سأخبرك بعد ذلك بجميع معلومات الملف (بيانات التعريف) التي أعرفها.", 17 | "helpmsgConvert": "استخدم هذا الأمر للرد على ملف! سأدرج بعد ذلك جميع التحويلات الممكنة لذلك.", 18 | "helpmsgFile": "حسنًا ، أرسل لي الآن ملفًا ليتم تحويله إلى ", 19 | "fileInfo": "ها هي معلومات ملفك:", 20 | "noFileInfo": "لم أتمكن من العثور على أي بيانات وصفية حول ملفك، آسف!", 21 | "reset": "أقوم بإعادة ضبط جميع إعداداتك ، بما في ذلك مفتاح API. اسف لرؤيتك تذهب! :(\nيمكنك دائمًا استعادة دقائق التحويل المجانية عن طريق الإرسال امر /contribute \n ", 22 | "cancelOperation": "إلغاء العملية.", 23 | "operationCancelled": "تم إلغاء العملية.", 24 | "helpmsgText": "لا أستطيع تحويل الرسائل النصية. بدلاً من ذلك ، أرسل لي ملفًا لتحويله!", 25 | "helpmsgTextKeySuggestion": "لا أستطيع تحويل الرسائل النصية. بدلاً من ذلك ، أرسل لي ملفًا لتحويله! هل تحاول تقديم مفتاح API الخاص بك؟ هذا ممكن بطريقتين. لا يهم أي واحد تختار. يمكنك إما: 1) إرسال الرسالة بالتنسيق التالي: \"/apikey ABC_YOUR_API_KEY_XYZ\" أو يمكنك أيضًا: 2) أرسل أولاً \"/apikey\" فقط. سأرد على ذلك. ثانيًا ، يرجى استخدام ميزة الرد على Telegram للرد على رسالتي .\nللمزيد المعلومات @cloud_convert_ar_bot \n", 26 | "apiKeyProvided": "شكرًا لك على توفير مفتاح API! حسابك الخاص جاهز الآن ومجهز. من خلال عدم الاعتماد على الحساب الافتراضي ، فإنك تساعد في جعل الروبوت أكثر فائدة للجميع هناك! لقد وعدت بالكشف عن أمر روبوت مخفي ، وأنا أحب الوفاء بالوعود! نحن هنا: كلما قدمت ملفًا ، أرسل /info للحصول على معلومات مفصلة حول ملفاتك. احذر ، فالكثير من الأشياء تقنية جدًا هناك ، ولكن هناك أيضًا مجموعة من الحقائق الرائعة التي ربما لا تعرفها. كم هو رائع ذلك ؟! تحقق من ذلك! \nالقناة العربية للبوت @cloud_convert_ar_bot \n", 27 | "personalApiKeyInUse": "نظرًا لأنك قدمت بالفعل مفتاح API الشخصي ، فسوف أستخدم أيضًا حساب CloudConvert الخاص بك في هذه الدردشة! اي! (إذا كنت لا تريد ذلك ، يمكنك إعادة تعيين الروبوت في هذه الدردشة.)", 28 | "fileTooBig": "الملف كبير جدًا! انظر للقيود /limitations", 29 | "unknownError": "هناك خطأ ما. اسف على ذلك. يمكنك الكتابة لي في @cloud_convert_bot_ar بسبب هذا.\n", 30 | "invalidApiKey": "مفتاح API الخاص بك غير صالح! هل اتبعت الخطوات الموجودة ضمن /contribute ؟ 1) تأكد من التحقق من حسابك على cloudconvert بالنقر فوق الرابط الموجود في البريد الإلكتروني الذي تلقيته بعد التسجيل في www.cloudconvert.com. 2) لا تكتب مفتاح API بنفسك فقد يكون هناك خطأ إملائي. بدلاً من ذلك ، انسخ والصق مفتاح API من موقع الويب مباشرةً. 3) لا تستخدم تسجيل الدخول إلى Facebook على www.cloudconvert.com. استخدم بريدًا إلكترونيًا بدلاً من ذلك. يجب أن يعمل تسجيل الدخول إلى Google أيضًا. 4) إذا لم ينجح شيء ، يمكنك إعادة إنشاء واجهة برمجة التطبيقات على لوحة القيادة والمحاولة /contribute مرة أخرى. بمجرد تقديم مفتاح صالح ، يمكنك دائمًا إلغاء الاشتراك مرة أخرى والعودة إلى استخدام الحساب المشترك بين جميع مستخدمي الروبوت. للقيام بذلك ، ما عليك سوى إعادة تعيين الروبوت باستخدام /reset إعادة تعيين. هذا هو مفتاح API غير صالح الذي \nاشترك وتابع قناة البوت @cloud_convert_ar_bot ", 31 | "noMoreConversionMinutes": "يبدو أنه لا توجد تحويلات مجانية متبقية! تحقق من الرصيد /balance ! سيتم تلقائيًا تزويدك بـ 25 تحويلًا مجانيًا إضافيًا خلال الـ 24 ساعة القادمة. إذا كنت لا تريد الانتظار ، يمكنك تحويل ملفك الآن. تحتاج فقط إلى اتباع الخطوات الموجودة ضمن /contribute المساهمة.", 32 | "listFormats": "ممتاز! يمكنني تحويل هذا ${filetype} إلى:\n", 33 | "autoConvert": "تحويل تلقائي من ${from} إلى ${to}", 34 | "pickLanguage": "اضبط لغتك باستخدام أحد الأزرار أدناه. تتحدث لغة أخرى؟ وجدت خطأ مطبعي؟ ساعد في ترجمة هذا الروبوت! ما عليك سوى مرسلتي @al_hmirey !", 35 | "languageName": "اللغة العربية 🇾🇪", 36 | "resultFileTooBig": "ملف النتيجة كبير جدًا! انظر القيود /limitations" 37 | } -------------------------------------------------------------------------------- /src/bot/locales/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKeyProvided": "Grazie per aver fornito la chiave API! Il vostro account è ora pronto e configurato. Non facendo più affidamento sull'account predefinito, contribuisci a rendere il bot più utile per tutti!\n\nHo promesso di svelare un comando per il bot nascosto, e mi piace mantenere le promesse! Ecco qui: ogni volta che avete fornito un file, inviate /info per ottenere informazioni dettagliate sui vostri file. Attenzione, molte cose sono piuttosto tecniche, ma ci sono anche un sacco di fatti interessanti che probabilmente non sapevate. Quanto è meraviglioso?! Provatelo!", 3 | "autoConversionSaved": "Salvata.", 4 | "autoConvert": "converti automaticamente ${from} in ${to}", 5 | "cancelOperation": "Annulla operazione", 6 | "customApiKeyInstruction": "Ti servono più conversioni? /contribute", 7 | "fileInfo": "Ecco le informazioni del file:", 8 | "fileTooBig": "Il file è troppo grande! Vedi /limitations", 9 | "helpmsgBalanceWithApiKey": "Evviva! Hai collegato il tuo account personale Cloud Convert con questo bot! Grazie! Puoi controllare il suo saldo con /balance.\n\nHai connesso il bot con la tua chiave API (grazie!).", 10 | "helpmsgBuyMinutes": "Se hai bisogno di effettuare ancora più conversioni, puoi acquistare i minuti di conversione su www.cloudconvert.com. Questo bot li utilizzerà automaticamente se disponibili. Tuttavia, ricorda che questo progetto è stato creato da un solo studente dell'Università di Kiel. Anche se ho fatto del mio meglio per mantenere questo software privo di errori e il più affidabile possibile, non posso garantire che questo bot non consumi accidentalmente tutti i vostri minuti di conversione, che uccida il vostro gattino o cose simili. Non è mai successo finora e lo considero altamente improbabile, ma è comunque un software, quindi non si sa mai. Se conosci TypeScript, puoi controllare il codice sorgente per verificare che qualcosa del genere non accada.", 11 | "helpmsgConvert": "Usa questo comando in risposta ad un file. Ti mostrerò tutte le possibili conversioni.", 12 | "helpmsgFeedback": "Ti piace questo bot? Dillo allo sviluppatore @KnorpelSenf o condividi i tuoi pensieri nella chat @cloud_convert_bot_lounge!\n\nIl modo migliore di contribuire è di fornire una chiave API.\n/contribute\nPuoi anche aiutare traducendo questo bot.", 13 | "helpmsgFile": "Ok, ora mandami un file da convertire in ", 14 | "helpmsgGroups": "Ciao!\nSono Cloud Convert Bot ti aiuterò a convertire i file!\nNon vi invierò alcun messaggio o file convertito (a meno che non lo chiediate gentilmente). Ci sono due modi per dirmi che devo convertire un file per voi:\n 1) Rispondi ad un file che qualcuno manda. Rispondi direttamente con il formato di destinazione (ad es. /mp4) o invia /convert per vedere i possibili formati. Utilizzerò il file più recente se non si preme il tasto \"Rispondi\" per qualsiasi messaggio.\n 2) Invia una descrizione mentre mandi un file, ad esempio /mp4 per convertire in MP4.\n\nUna volta completata la conversione, è possibile abilitare le auto-conversioni. Se si abilitano le auto-conversioni per un tipo di file, ripeterò automaticamente questa conversione per tutti i file dello stesso tipo.\n\nLa caratteristica più bella è che puoi creare il tuo account. Questo bot può funzionare per un certo periodo di tempo senza un account, ma se si utilizza il bot regolarmente, la creazione di un account è molto importante perché si possono ottenere molte più conversioni gratuite come questa. Impostalo con /contribute. In questo modo, si possono evitare alcune limitazioni (/limitations) e si contribuisce anche a questo bot (che è davvero utile).\n\nNota che i comandi in questo gruppo devono finire con il mio username (@cloud_convert_bot), altrimenti li ignorerò, (quindi non /mp4, ma /mp4@cloud_convert_bot)", 15 | "helpmsgInfo": "Usa questo comando in risposta ad un file. Ti dirò tutte le informazioni (metadata) che trovo in quel file.", 16 | "helpmsgLimitations": "Ci sono due limitazioni. Primo: puoi convertire solo pochi files al giorno. Secondo: puoi convertire solo file di una certa dimensione.\n\nPoiché tutti gli utenti condividono una riserva comune di 25 conversioni giornaliere e altri utenti possono utilizzare le tue conversioni (controlla /balance), potresti non riuscire a convertire alcun file. La cosa buona e: puoi semplicemente impostare un account e BOOM, il limite è svanito! Vedi /contribute per altre informazioni.\n\nTelegram non consente ai bot (come me) di scaricare file più grandi di 20 mb e di caricarne di più grandi di 50 mb. Questo limite non può essere modificato. Se devi convertire file più grandi visita cloudconvert.com. Mi dispiace!", 17 | "helpmsgPrivate": "Ciao! Sono un bot per convertire file. Supporto 218 diversi formati di file e so gestire media di qualsiasi tipo (file audio, documenti, GIF, foto, sticker, video, messaggi vocali e video messaggi)\n\nIMPORTANTE: Puoi provarmi gratuitamente. Se avete bisogno di convertire un solo file, procedete pure e fatelo. Comunque, questo bot è un progetto comunitario. Se vuoi usare questo bot più spesso, per favore contribuisci fornendo una chiave API: vedi /contribute. Ci vogliono 30 secondi ed è facilissimo. Avrai 25 conversioni gratis al giorno. Si tratta di creare un account. (Non preoccuparti, è gratuito per sempre).\n\nSupporto anche le conversioni automatiche dei file (anche nelle chat di gruppo)! Abilita le conversioni automatiche se hai molti file dello stesso tipo da convertire. È possibile abilitare le conversioni automatiche non appena si converte un file.\n\nÈ possibile impostare la lingua con /language.\n\nRicorda che questo bot non funzionerebbe senza i molti contributori che ha: diventa uno di noi! /contribute\n\nGruppo di discussione: @cloud_convert_bot_lounge\nCanale di aggiornamenti: @cloud_convert_bot_news", 18 | "helpmsgSetUpAccount": "Benvenuto, prossimo contributore del bot!\nContribuendo al bot potrai richiedere 25 conversioni extra gratuite al giorno! Nessun altro potrà modificare questo contatore. Non dovrai pagare niente per questo, e funzionerà senza bisogno di stregonerie. Ti basterà seguire questi tre passaggi:\n1) Crea il tuo account Cloud Convert (se non ce l'hai già) qui.\n2) Visita la dashboard e copia la tua chiave API.\n3) Torna in questa chat e manda /apikey. Incolla la chiave in questa chat.\nFatto! Ogni tua operazione sarà basata sul tuo account Cloud Convert! Puoi resettare il bot con /reset, ciò eliminerà la tua chiave dal nostro database. Quando mi avrai mandato la chiave ti farò scoprire un comando segreto.\n\nTieni a mente che né il bot né il suo sviluppatore sono in alcun modo collegati a cloudconvert.com. Le persone dietro quel sito offrono conversioni gratuite e un modo comodo per connettere i bot al servizio. Hanno sede a Monaco di Baviera, in Germania, e non dovrai preoccuparti della privacy, di pubblicità o di altre stronzate simili quando ti iscriverai. Ricorda che connettere il tuo bot è parecchio utile se pensi di usarlo spesso.", 19 | "helpmsgStartGroups": "Ciao!\nSono Cloud Convert Bot ti aiuterò a convertire i file! Digita /help per un tour veloce, imposta la lingua con /language - e non dimenticare di impostare un account: /contribute", 20 | "helpmsgStartPrivate": "Ciao!\nTi aiuterò a convertire i tuoi file!\nMandami pure un file da convertire. /help", 21 | "helpmsgText": "Non posso convertire messaggi di testo. Mandami piuttosto un file da convertire!", 22 | "helpmsgTextKeySuggestion": "Non posso convertire messaggi di testo. Mandami piuttosto un file da convertire!\n\nStai cercando di mandarmi la chiave API? Ci son due modi per farlo:\n1) Manda il messaggio in questo formato: “/apikey ABC_LA_TUA_API_XYZ”\n2) Invia /apikey e rispondi al messaggio che ti manderò.", 23 | "invalidApiKey": "La tua chiave API è invalida! Hai seguito i passaggi di /contribute?\n\n1) Non trascrivere la chiave, copincollala dal sito.\n2) Non fare il login con Facebook su www.cloudconvert.com. Uspiuttosto una mail. Il login con Google non dovrebbe dare problemi.\n3) Se nulla funziona rigenera la chiave API dalla tua dashboard, e ridai il comando /contribute.\n\nUna volta fornita una chiave valida, si può sempre decidere di ritirarsi e tornare a utilizzare l'account condiviso da tutti gli utenti del bot. Per farlo, è sufficiente resettare il bot con /reset.\n\nQuesta è la chiave API che hai fornito:", 24 | "languageName": "🇮🇹 Italiano", 25 | "listFormats": "Perfetto! Posso convertire questo ${filetype} in:", 26 | "noFileInfo": "Non trovo alcun metadato in questo file, mi spiace.", 27 | "noMoreConversionMinutes": "Sembra che non ci siano più conversioni gratuite! Verifica /balance!\n\nVi saranno automaticamente fornite altre 25 conversioni gratuite entro le prossime 24 ore. Se non vuoi aspettare, puoi convertire il tuo file adesso. Devi solo seguire i passi sotto /contribute.", 28 | "operationCancelled": "Operazione annullata.", 29 | "personalApiKeyInUse": "Dal momento che hai già fornito la tua chiave API personale, userò anche il tuo account CloudConvert in questa chat! Evviva! (Se non lo vuoi, puoi resettare il bot in questa chat).", 30 | "pickLanguage": "Imposta la tua lingua con i bottoni qui sotto.\n\nParli un'altra lingua? Hai trovato un errore? Aiuta a tradurre il bot! Clicca su questo link!", 31 | "remainingConversions": "Conversioni rimaste.", 32 | "reset": "Ho resettato la configurazione, compresa la chiave API. Mi spiace vederti andare! :(\nPuoi sempre riavere le tue conversioni gratis con /contribute!", 33 | "resultFileTooBig": "Il file convertito è troppo grande, vedi /limitations!", 34 | "sendApiKey": "Ottimo! Ora mandami la chiave API in risposta a questo messaggio.", 35 | "unknownError": "Qualcosa è andato storto. Mi spiace. Scrivimi su @cloud_convert_bot_lounge e spiega cos'è successo.", 36 | "validatingApiKey": "Convalida..." 37 | } -------------------------------------------------------------------------------- /src/bot/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKeyProvided": "Thank you for providing the API key! Your own account is now ready and set up. By no longer relying on the default account, you help making the bot more useful for everyone out there!\n\nI promised to unveil a hidden bot command, and I like to keep promises! Here we go: whenever you provided a file, send /info to get detailed information about your files. Beware, a lot of things are pretty technical there, but there's also a bunch of cool facts you probably didn't know. How awesome is that?! Check it out!", 3 | "autoConversionSaved": "Saved.", 4 | "autoConvert": "auto-convert ${from} to ${to}", 5 | "cancelOperation": "Cancel operation", 6 | "customApiKeyInstruction": "Need to perform more conversions? /contribute", 7 | "fileInfo": "Here's your file info:", 8 | "fileTooBig": "The file is too big! See /limitations", 9 | "helpmsgBalanceWithApiKey": "Yay! You have connected your personal Cloud Convert account with this bot! Thank you! You can check its balance with /balance.\n\nYou connected this bot by providing the following API key (thanks!):", 10 | "helpmsgBuyMinutes": "If you need to perform even more conversions, you can buy conversion minutes at www.cloudconvert.com. This bot will automatically use them if available. However, please remember that this project was created by a single student at Kiel University. Even though I did my best to keep this piece of software free of errors and as reliable as possible, I cannot guarantee that this bot is not accidentally consuming all of your conversion minutes, killing your kitten or the like. It has never happened so far and I consider it highly unlikely, but it is still software, so you never know. If you know TypeScript, you can check out the source code to verify that something as bad as this won't ever happen.", 11 | "helpmsgConvert": "Use this command in reply to a file! I will then list all possible conversions for that.", 12 | "helpmsgFeedback": "Like this bot? Tell the dev @KnorpelSenf or share your thoughts in the discussion group at @cloud_convert_bot_lounge!\n\nThe best way to say thank you is by providing an API key. /contribute\nYou can also help translate this bot.", 13 | "helpmsgFile": "Alright, now send me a file to be converted to ", 14 | "helpmsgGroups": "Hi there!\nMy name is Cloud Convert Bot and I can help you with file conversions!\nI will not spam you with any messages or any converted files (unless you ask nicely). There is two ways to tell me that I should convert a file for you:\n 1) Reply to a file someone sends. Reply with the target format directly (e. g. /mp4) or send /convert to see possible formats. I will use the most recent file if you do not hit reply for any message.\n 2) Send a caption when you send the file, e. g. /mp4 to convert to MP4.\n\nOnce the conversion is completed, you can enable auto-conversions. If you enable auto-conversions for a file type, I will automatically repeat this conversion for all files of the same type.\n\nThe most awesome feature is that you can set up your own account. This bot can work for some time without an account, but if you use the bot regularly, setting up an account is really important because you can get waaay more free conversions like that. Set it up with /contribute. This way, you can avoid some /limitations and you also contribute to this bot (which is really helpful).\n\nNote that all commands in this group chat need to end on “@cloud_convert_bot”, otherwise I will ignore them (e.g. not /mp4 but /mp4@cloud_convert_bot)!", 15 | "helpmsgInfo": "Use this command in reply to a file! I will then tell you all file information (meta data) I know.", 16 | "helpmsgLimitations": "Currently there is two limitations. First: you can only convert a few files a day. Second: you can only convert files up a certain size.\n\nBecause all users of this bot share a common pool of 25 conversions per day and other users can consume your conversions (check the balance with /balance), you sometimes cannot convert any file at all. The good thing is: you simply need to set up an account and BOOM—this limit is gone! See /contribute for that!\n\nTelegram does not allow bots (like me) to download files with more than 20 MB in size or upload files with more than 50 MB in size. This limit cannot be changed. If you need to convert larger files, you could visit cloudconvert.com. Sorry!", 17 | "helpmsgPrivate": "Hi! I am a file converter bot. I support 218 different file formats and I know how to handle media of any kind (audio files, documents, GIFs, photos, stickers, videos, voice notes, and video notes).\n\nIMPORTANT: You can try me out for free. If you need to convert only one file, just go ahead and do it. However, this bot is a community project. If you want to use this bot more often, please contribute by providing an API key: see /contribute. This only takes 30 seconds and it is dead simple. You will be rewarded with 25 free extra-conversions every day. It involves setting up an account. (Don't worry, it is free forever.)\n\nI also support automatic file conversions (even in group chats)! Enable automatic conversions if you have a lot of files of the same type to convert. You can enable auto-conversions as soon as you converted a file.\n\nYou can set the language with /language.\n\nRemember that this bot would not work without the many contributors it has—become one of them! /contribute\n\nDiscussion group: @cloud_convert_bot_lounge\nNews channel: @cloud_convert_bot_news", 18 | "helpmsgSetUpAccount": "Welcome, future bot contributor!\nBy contributing to the bot, you can claim your own 25 free extra-conversions per day! No one else will be able to impact this counter. You will not have to pay anything for this and it works entirely without witchcraft. All you need to do is to follow these three steps:\n1) Create your own Cloud Convert account here.\n2) Visit the dashboard and copy the API key.\n3) Get back to this chat and send /apikey. Paste the API key into this chat.\nGood job! Now every single operation of this bot will work based on your new Cloud Convert account! Resetting the bot with /reset clears the API key from our database. Once you sent me your API key, I will tell you a secret bot command as a thank-you gift!\n\nPlease note that neither this bot nor its dev are in any way associated with cloudconvert.com. The people behind that site just offer free file conversions and they have a neat way to connect bots to that service. They're based in Munich, Germany and you do not need to worry about privacy concerns or ads or \"we miss you\" bullshit once you signed up. Remember that connecting your own account to this bot is very important for this bot to function.", 19 | "helpmsgStartGroups": "Hi there!\nMy name is Cloud Convert Bot and I can help you with file conversions! Type /help for a quick tour, set your language with /language—and don't forget to set up your account: /contribute", 20 | "helpmsgStartPrivate": "Hi there!\nI can help you with file conversions!\nPlease send me your file to convert. /help", 21 | "helpmsgText": "I cannot convert text messages. Instead, send me a file to convert it!", 22 | "helpmsgTextKeySuggestion": "I cannot convert text messages. Instead, send me a file to convert it!\n\nAre you trying to submit your API key? This is possible in two ways. It does not matter which one you choose. You can either:\n1) Send the message in the following format: “/apikey ABC_YOUR_API_KEY_XYZ”\nOr you can just as well:\n2) First send just “/apikey”. I will respond to that. Second, please use the Telegram reply feature to reply to my message when you in turn submit your API key.", 23 | "invalidApiKey": "Your API key is invalid! Did you follow the steps under /contribute?\n\n1) Make sure you verified your cloudconvert account by clicking the link in the email you received after registering at www.cloudconvert.com.\n2) Do not type the API key yourself as there could be a typo. Instead, copy and paste the API key from the website directly.\n3) Do not use Facebook login on www.cloudconvert.com. Use an email instead. Google login should work, too.\n4) If nothing works, you can re-generate the API on the dashboard and try /contribute again.\n\nOnce you provided a valid key, you can always opt out again and return to using the account shared among all bot users. To do so, simply reset the bot with /reset.\n\nThis is the invalid API key you provided:\n", 24 | "languageName": "🇬🇧 English", 25 | "listFormats": "Awesome! I can convert this ${filetype} to:", 26 | "noFileInfo": "I couldn't find any meta data about your file, sorry!", 27 | "noMoreConversionMinutes": "It looks like there is no free conversions remaining! Check /balance!\n\nYou will automatically be provided with 25 more free conversions within the next 24 hours. If you don't want to wait, can convert your file right now. You just need to follow the steps under /contribute.", 28 | "operationCancelled": "Operation cancelled.", 29 | "personalApiKeyInUse": "Since you already provided your personal API key, I will also use your CloudConvert account in this chat! Yay! (If you do not want this, you can reset the bot in this chat.)", 30 | "pickLanguage": "Set your language using one of the buttons below.\n\nSpeak another language? Found a typo? Help translate this bot! Simply click this link!", 31 | "remainingConversions": "Remaining conversions", 32 | "reset": "I reset all your configuration, including the API key. Sorry to see you go! :(\nYou can always get your free conversion minutes back by sending /contribute!", 33 | "resultFileTooBig": "The result file is too big! See /limitations", 34 | "sendApiKey": "Perfect! Now send me the API key in reply to this message!", 35 | "unknownError": "Something went wrong. Sorry for that. You may write me in @cloud_convert_bot_lounge because of this.", 36 | "validatingApiKey": "Validating ..." 37 | } -------------------------------------------------------------------------------- /src/bot/locales/kn.json: -------------------------------------------------------------------------------- 1 | { 2 | "helpmsgStartPrivate": "ನಮಸ್ತೆ!\nನಾನು ನಿಮಗೆ ಫೈಲ್ ಪರಿವರ್ತನೆಯಲ್ಲಿ ಸಹಾಯ ಮಾಡಬಲ್ಲೆ!\nದಯವಿಟ್ಟು ಒಂದು ಫೈಲ್‌ ಅನ್ನು ನನಗೆ ಕಳಿಸಿ. /help", 3 | "helpmsgPrivate": "ನಮಸ್ತೆ! ನಾನು ಒಂದು ಫೈಲ್ ಪರಿವರ್ತನಾ ಬೊಟ್ ಆಗಿದ್ದೇನೆ. ನಾನು ೨೧೮ ವಿಭಿನ್ನ ಫೈಲ್ ಫಾರ್ಮ್ಯಾಟ್ ಗಳನ್ನು ಬೆಂಬಲಿಸಬಲ್ಲೆ ಮತ್ತು ಯಾವುದೇ ತರಹದ ಮೀಡಿಯಾ ಫೈಲ್ ಗಳನ್ನು ಪರಿವರ್ತಿಸಬಲ್ಲೆ (ಶಬ್ದ ಫೈಲ್ ಗಳು, ದಾಖಲೆಗಳು, GIFಗಳು, ಚಿತ್ರಗಳು, ಸ್ಟಿಕರ್‌ಗಳು, ವಿಡಿಯೋಗಳು, ಮೌಖಿಕ ಟಿಪ್ಪಣಿಗಳು, ಹಾಗೂ ವಿಡಿಯೋ ಟಿಪ್ಪಣಿಗಳು). \n\nಮುಖ್ಯಾಂಶ: ನೀವು ನನ್ನನ್ನು ಉಚಿತವಾಗಿ ಉಪಯೋಗಿಸಬಹುದು. ನೀವು ಕೇವಲ ಒಂದು ಫೈಲ್ ಅನ್ನು ಮಾತ್ರ ಪರಿವರ್ತಿಸುವ ಹಾಗಿದ್ದರೆ ಇದನ್ನು ಬಳಸಿ, ಆದರೆ ಇದೊಂದು ಸಾಮುದಾಯಿಕ ಯೋಜನೆ ಆಗಿರುವುದರಿಂದ ನೀವು ಹೆಚ್ಚಾಗಿ ಬಳಸುವ ಹಾಗಿದ್ದಲ್ಲಿ, ದಯವಿಟ್ಟು ಒಂದು API Key ಅನ್ನು ಕೊಟ್ಟು ಸಹಾಯ ಮಾಡಿ - /contribute ನೋಡಿರಿ. ಇದು ಕೇವಲ ೩೦ ಸೆಕೆಂಡುಗಳ ಒಂದು ಸುಲಭ ಕೆಲಸವಾಗಿದೆ. ಇದನ್ನು ಮಾಡಿದರೆ ನಿಮಗೆ ೨೫ ಉಚಿತ ಹೆಚ್ಚುವರಿ ಪರಿವರ್ತನೆಗಳನ್ನು ನೀಡಲಾಗುವುದು. ಇದಕ್ಕೆ ನೀವು ಒಂದು ಖಾತೆಯನ್ನು ತೆರೆಯಬೇಕು. (ಚಿಂತಿಸಬೇಡಿ, ಈ ಬೋಟ್ ಯಾವತ್ತೂ ಉಚಿತವಾಗಿಯೇ ಉಳಿಯುವುದು.)\n\nನಾನು ಸ್ವಯಂ ಪರಿವರ್ತನೆ ಕೂಡ ಮಾಡಬಲ್ಲೆ (ಗುಂಪು ಚಾಟ್ ಗಳಲ್ಲಿಯೂ)! ನಿಮ್ಮ ಬಳಿ ಸಾಕಷ್ಟು ಒಂದೇ ಫಾರ್ಮ್ಯಾಟ್ ನ ಫೈಲ್‌ಗಳಿದ್ದಲ್ಲಿ ಸ್ವಯಂ ಪರಿವರ್ತನೆಯನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ. ಒಂದು ಫೈಲ್ ಅನ್ನು ಪರಿವರ್ತಿಸಿದ ತಕ್ಷಣ ಸ್ವಯಂ ಪರಿವರ್ತನೆಯನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಬಹುದು.\n\nಭಾಷೆಯನ್ನು ಬದಲಾಯಿಸಲು /language ಬಳಸಿ.\n\nಒಂದು ವಿಷಯ ನೆನಪಿನಲ್ಲಿಡಿ - ಈ ಬೋ‌ಟ್‌ ಕೆಲಸ ಮಾಡಲು ಅದರ ಕೊಡುಗೆದಾರರೇ ಕಾರಣ. ಅವರಲ್ಲಿ ಒಬ್ಬರಾಗಲು /contribute ಅನ್ನು ನೋಡಿ.\n\nಚರ್ಚಾ ಗುಂಪು - @cloud_convert_bot_lounge\nಸಮಾಚಾರ ಚಾನೆಲ್ - @cloud_convert_bot_news", 4 | "helpmsgStartGroups": "ನಮಸ್ತೆ!\nನನ್ನ ಹೆಸರು Cloud Convert Bot ಮತ್ತು ನಾನು ನಿಮಗೆ ಫೈಲ್ ಪರಿವರ್ತನೆಯಲ್ಲಿ ಸಹಾಯ ಮಾಡಬಲ್ಲೆ! /help ಎಂದು ಟೈಪ್ ಮಾಡಿದರೆ ನನ್ನ ಒಂದು ತ್ವರಿತ ಪರಿಚಯ ನೀಡುವೆನು, ಭಾಷೆ ಬದಲಾಯಿಸಲು /language ಎಂದು ಟೈಪ್ ಮಾಡಿ — ಹಾಗೆಯೇ ನಿಮ್ಮ ಖಾತೆ ಸೆಟಪ್ ಮಾಡಲು ಮರೆಯದಿರಿ: /contribute", 5 | "helpmsgGroups": "ನಮಸ್ತೆ!\nನಾನು Cloud Convert Bot, ನಿಮಗೆ ಫೈಲ್‌ಗಳನ್ನು ಬೇರೆ ಫಾರ್ಮ್ಯಾಟ್‌ಗೆ ಪರಿವರ್ತಿಸಲು ಸಹಾಯ ಮಾಡುತ್ತೇನೆ!\nನಾನು ನಿಮಗೆ ಯಾವುದೇ ರೀತಿಯ ಅನಗತ್ಯ ಸಂದೇಶಗಳನ್ನು ಅಥವಾ ಪರಿವರ್ತಿತ ಫೈಲ್‌ಗಳನ್ನು ಕಳಿಸುವುದಿಲ್ಲ (ಪ್ರೀತಿಯಿಂದ ಕೇಳಿದರೆ ಮಾತ್ರ). ನೀವು ಎರಡು ರೀತಿಗಳಲ್ಲಿ ನನಗೆ ಫೈಲ್ ಪರಿವರ್ತಿಸಲು ಹೇಳಬಹುದು:\n೧) ಯಾವುದೇ ಫೈಲ್‌ನ ಮೇಲೆ ಉತ್ತರಿಸಿ. ನೇರವಾಗಿ ಫಾರ್ಮ್ಯಾಟ್ ಅನ್ನು ಕಳಿಸಿ, ಉದಾ: /mp4 ಅಥವಾ ಬರಿ /convert ಎಂದು ಕಳಿಸಿದರೆ ಆ ಫೈಲ್‌ನ ಪರಿವರ್ತಿಸಲು ಎಲ್ಲಾ ಲಭ್ಯ ಫಾರ್ಮ್ಯಾಟ್‌ಗಳನ್ನು ತೋರಿಸಲಾಗುವುದು. ಯಾವುದೇ ಸಂದೇಶದ ಮೇಲೆ ಉತ್ತರಿಸದಿದ್ದಲ್ಲಿ, ನಾನು ಇತ್ತೀಚಿನ ಫೈಲ್ ಅನ್ನು ಬಳಸುತ್ತೇನೆ.\n೨) ಫೈಲ್ ಅನ್ನು ಕಳಿಸುವಾಗ ಒಂದು ಕ್ಯಾಪ್ಶನ್ ಕಳಿಸಿ. ಉದಾ: mp4 ಗೆ ಪರಿವರ್ತಿಸಲು /mp4 ಎಂದು ಕಳಿಸಿ.\n\nಪರಿವರ್ತನೆ ಆದ ಬಳಿಕ, ಸ್ವಯಂ ಪರಿವರ್ತನೆಯನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಬಹುದು. ಅದಾದ ಬಳಿಕ ಈ ರೀತಿಯ ಎಲ್ಲಾ ಫೈಲ್‌ಗಳನ್ನು ನಾನು ಸ್ವಯಂಚಾಲಿತವಾಗಿ ಪರಿವರ್ತಿಸುತ್ತೇನೆ.\n\nಇದರ ಒಂದು ಅತ್ಯದ್ಭುತ ವೈಶಿಷ್ಟ್ಯವೇನೆಂದರೆ ನಿಮ್ಮದೇ ಆದ ಖಾತೆಯನ್ನು ಬಳಸಿ ಇನ್ನೂ ಹೆಚ್ಚಿನ ಪರಿವರ್ತನಾ ನಿಮಿಷಗಳನ್ನು ಪಡೆಯಬಹುದು. ಇದಿಲ್ಲದೆಯೂ ಬೋಟ್ ಕೆಲಸ ಮಾಡಬಹುದು ಆದರೆ ನೀವು ಹೆಚ್ಚಿನ ಸಮಯ ಇದನ್ನು ಬಳಸಲಾಗದು. ಆದ್ದರಿಂದ /contribute ಒತ್ತಿ. ಈ ರೀತಿ ನೀವು /limitations ಇಲ್ಲದೆ ಪರಿವರ್ತಿಸಲು ಸಹಾಯ ಮಾಡುತ್ತದೆ ಹಾಗೂ ಬೋಟ್ ಕೊಡುಗೆದಾರ ಸಹ ಆಗುವಿರಿ.\n\nಗುಂಪುಗಳಲ್ಲಿ ಎಲ್ಲಾ ಆಜ್ಞೆಗಳು \"@cloud_convert_bot\" ಇಂದ ಕೊನೆಗೊಳ್ಳಬೇಕು, ಇಲ್ಲದಿದ್ದರೆ ಆ ಆಜ್ಞೆಗಳನ್ನು ನಾನು ಪರಿಗಣಿಸುವುದಿಲ್ಲ (/mp4 ಬದಲಾಗಿ /mp4@cloud_convert_bot ಬಳಸಿ)!", 6 | "helpmsgLimitations": "ಸದ್ಯ ಎರಡು ಮಿತಿಗಳಿವೆ. ಮೊದಲನೇಯದಾಗಿ, ಕೇವಲ ಕೆಲವು ಸಂಖ್ಯೆಯಷ್ಟು ಫೈಲ್‌ಗಳನ್ನು ಮಾತ್ರ ಪರಿವರ್ತಿಸಬಹುದು. ಎರಡನೇಯದಾಗಿ, ಹೆಚ್ಚು ಗಾತ್ರದ ಫೈಲ್‌ಗಳನ್ನು ಪರಿವರ್ತಿಸಲು ಆಗುವುದಿಲ್ಲ.\n\nಇದಕ್ಕೆ ಕಾರಣ ಏನೆಂದರೆ ಈ ಬೋಟ್‌ನ ಎಲ್ಲಾ ಬಳಕೆದಾರರು ಒಂದು ಸಾಮಾನ್ಯ ಖಾತೆಯನ್ನು ಬಳಸುತ್ತಾರೆ. ಅದರಲ್ಲಿ ಕೇವಲ ೨೫ ಪರಿವರ್ತನೆಗಳು ಮಾತ್ರ ಇರುತ್ತವೆ. ಬೇರೆಯವರು ಸಹ ಈ ಪರಿವರ್ತನೆಗಳನ್ನು ಬಳಸುವುದರಿಂದ ಅದು ಬೇಗನೆ ಖಾಲಿಯಗಬಹುದು(ಬಾಕಿ ನೋಡಲು /balance ಒತ್ತಿ), ಕೆಲವು ಸಲ ಯಾವುದೇ ಪರಿವರ್ತನೆ ಮಾಡಲು ಸಹ ಆಗುವುದಿಲ್ಲ. ಒಂದು ಒಳ್ಳೆಯ ಸಂಗತಿ ಏನೆಂದರೆ ನೀವು ಒಂದು ಖಾತೆ ತೆರೆದರೆ ಆ ಮಿತಿಯೂ ಮಾಯವಾಗುವುದು! /contribute ನೋಡಿರಿ!\n\nಟೆಲಿಗ್ರಾಂ ಒಂದು ಬೋಟ್‌ಗೆ ೨೦MBಗಿಂತ ಹೆಚ್ಚಿನ ಗಾತ್ರದ ಫೈಲ್‌ಗಳನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಲು ಅಥವಾ ೫೦MBಗಿಂತ ಹೆಚ್ಚಿನ ಗಾತ್ರದ ಫೈಲ್‌ಗಳನ್ನು ಅಪ್ಲೋಡ್ ಮಾಡಲು ಬಿಡುವುದಿಲ್ಲ. ಈ ಮಿತಿಯನ್ನು ಬದಲಿಸಲು ಆಗುವುದಿಲ್ಲ. ಹೆಚ್ಚಿನ ಗಾತ್ರದ ಫೈಲ್‌ಗಳನ್ನು ಪರಿವರ್ತಿಸಲು cloudconvert.com ಗೆ ಭೇಟಿ ನೀಡಿ. ಇದಕ್ಕಾಗಿ ಕ್ಷಮೆ ಇರಲಿ!", 7 | "helpmsgSetUpAccount": "ಸುಸ್ವಾಗತ, ಭಾವಿ ಬೊಟ್ ಕೊಡುಗೆದಾರ!\n\nಈ ಬೋಟ್‌ನ ಕೊಡುಗೆದಾರರಾದರೆ, ನೀವು ೨೫ ಹೆಚ್ಚು ಪರಿವರ್ತನೆಗಳನ್ನು ಪಡೆಯುವ ಅವಕಾಶ ಹೊಂದಿದ್ದೀರಿ. ಯಾರು ಕೂಡ ಇದನ್ನು ಕಸಿಯಲಾರರು. ನೀವು ಒಂದು ನಯಾ ಪೈಸೆ ಕೂಡ ನೀಡಬೇಕಾಗಿಲ್ಲ, ಯಾವುದೇ ಜಾದು ಇಲ್ಲದೆ ಇದು ಕೆಲಸ ಮಾಡುತ್ತದೆ. ನೀವು ಏನು ಮಾಡಬೇಕೆಂದರೆ:\n\n೧) CloudConvert.com ಗೆ ಭೇಟಿ ನೀಡಿ ನಿಮ್ಮ ಖಾತೆ ತೆರೆಯಿರಿ.\n೨) Dashboard ಗೆ ಹೋಗಿ API Key ಅನ್ನು ಕಾಪಿ ಮಾಡಿ.\n೩) ಈ ಚಾಟ್‌ಗೆ ವಾಪಸ್ಸಾಗಿ /apikey ಎಂದು ಕಳಿಸಿ. ಹಿಂದಿನ ಸೂಚನೆಯಲ್ಲಿ ಕಾಪಿ ಮಾಡಿದ API Key ಅನ್ನು ಇಲ್ಲಿ ಪೇಸ್ಟ್ ಮಾಡಿ.\n\nಒಳ್ಳೆಯ ಕೆಲಸ ಮಾಡಿದ್ದೀರಿ! ಈಗ ಎಲ್ಲಾ ಕಾರ್ಯಾಚರಣೆಗಳು ನಿಮ್ಮ Cloud Convert ಖಾತೆಯ ಮುಖಾಂತರ ಕೆಲಸ ಮಾಡುತ್ತದೆ! /reset ಒತ್ತಿ ಬೋಟ್ ರೀಸೆಟ್ ಮಾಡಿದರೆ API Key ಕೂಡಾ ಅಳಿಸಲಾಗುವುದೆಂದು ಮರೆಯದಿರಿ. ಒಮ್ಮೆ ನೀವು ನಿಮ್ಮ API Key ಕಳಿಸಿದಾಗ ಒಂದು ಗುಟ್ಟಾದ ಆಜ್ಞೆಯನ್ನು ಒಂದು ಕೊಡುಗೆಯಾಗಿ ನೀಡುತ್ತೇನೆ!\n\nದಯವಿಟ್ಟು ಗಮನಿಸಿ - ಈ ಬೋಟ್ ಅಥವಾ ಈ ಬೋಟ್ ನ ಡೆವಲಪರ್, cloudconvert.com ನ ಜೊತೆ ಯಾವುದೇ ನಂಟು ಹೊಂದಿಲ್ಲ. ಆ ವೆಬ್‌ಸೈಟ್ ನ ಸೃಷ್ಟಿಕರ್ತರು ಉಚಿತವಾಗಿ ಫೈಲ್ ಪರಿವರ್ತನೆಯನ್ನು ನೀಡುತ್ತಿದ್ದಾರೆ ಹಾಗೂ ಒಂದು ಒಳ್ಳೆಯ ರೀತಿ ಬೋಟ್‌ಗಳನ್ನು ಅವರ ಸೇವೆಗೆ ಸಂಪರ್ಕಿಸಲು ದಾರಿ ಮಾಡಿಕೊಟ್ಟಿದ್ದಾರೆ. ಅವರು ಜರ್ಮನಿಯ ಮ್ಯೂನಿಕ್ ಮೂಲದವರಾಗಿದ್ದು, ಗೌಪ್ಯತೆಯ ಬಗ್ಗೆ ತಲೆ ಕೆಡಿಸಿಕೊಳ್ಳುವ ಅಗತ್ಯವಿಲ್ಲ, ಹಾಗೆಯೇ ಯಾವುದು ಜಾಹೀರಾತು ಅಥವಾ \"we miss you\" ರೀತಿಯ ಈಮೇಲ್‌ಗಳಾಗಲಿ ಕಳಿಸುವುದಿಲ್ಲ.\nನೆನಪಿಡಿ ನಿಮ್ಮ ಸ್ವಂತ ಖಾತೆಯನ್ನು ಸಂಪರ್ಕಿಸುವುದರಿಂದ ಈ ಬೋಟ್ ಕೆಲಸ ಮಾಡಲು ಅತ್ಯಂತ ಸಹಕಾರಿಯಾಗುವುದು.", 8 | "helpmsgBalanceWithApiKey": "ತುಂಬಾ ಸಂತೋಷ! ನೀವು ನಿಮ್ಮ CloudConvert ಖಾತೆಯನ್ನು ಈ ಬೋಟ್‌ನೊಂದಿಗೆ ಸಂಪರ್ಕಿಸಿರುವಿರಿ! ಧನ್ಯವಾದಗಳು! ಬಾಕಿ ಪರಿವರ್ತನೆಗಳನ್ನು /balance ನಲ್ಲಿ ನೋಡಿ.", 9 | "validatingApiKey": "ದೃಢೀಕರಿಸಲಾಗುತ್ತಿದೆ ...", 10 | "helpmsgBuyMinutes": "ನಿಮಗೆ ಇನ್ನೂ ಹೆಚ್ಚು ಪರಿವರ್ತನೆಗಳು ಬೇಕಾದಲ್ಲಿ CloudConvert.com ನಲ್ಲಿ ಪರಿವರ್ತನಾ ನಿಮಿಷಗಳನ್ನು ಖರೀದಿಸಬಹುದು. ಈ ಬೋಟ್, ಖರೀದಿ ಮಾಡಿದ ನಿಮಿಷಗಳನ್ನು ಸ್ವಯಂಚಾಲಿತವಾಗಿ ಪರಿವರ್ತನೆಗಾಗಿ ಬಳಸುತ್ತದೆ. ಆದರೆ ದಯವಿಟ್ಟು ಇದನ್ನು ಮನಸಿನಲ್ಲಿ ಇಟ್ಟುಕೊಳ್ಳಿ - ಈ ಯೋಜನೆಯು ಕಿಯೆಲ್ ವಿಶ್ವವಿದ್ಯಾಲಯದ ಒಬ್ಬ ವಿದ್ಯಾರ್ಥಿಯಿಂದ ಮಾಡಲ್ಪಟ್ಟಿದೆ. ನಾನು ಅದಷ್ಟು ಈ ಸಾಫ್ಟ್‌ವೇರ್ ಅನ್ನು ಯಾವುದೇ ದೋಷಗಳಿಲ್ಲದ ಹಾಗೆ ಇಡಲು ಪ್ರಯತ್ನಿಸಿದ್ದೇನೆ, ಆದಾಗ್ಯೂ ನಾನು ನಿಮಗೆ ಖಚಿತವಾಗಿ ಈ ಬೋಟ್ ನಿಮ್ಮ ಪರಿವರ್ತನಾ ನಿಮಿಷಗಳನ್ನು ಅಚಾನಕ್ಕಾಗಿ ಶೂನ್ಯಗೊಳಿಸುವುದಿಲ್ಲ ಅಥವಾ ನಿಮ್ಮ ಬೆಕ್ಕನ್ನು ಸಾಯಿಸುವುದಿಲ್ಲವೆಂದು ಹೇಳುವುದಕ್ಕಾಗುವುದಿಲ್ಲ. ಈ ರೀತಿ ಯಾವತ್ತೂ ಆಗಿಲ್ಲ, ಬಹುಶಃ ಆಗುವುದಿಲ್ಲವೆಂದು ಅಂದುಕೊಂಡಿದ್ದೇನೆ, ಆದರೆ ಯಾರಿಗೆ ಗೊತ್ತು? ಇದು ಕೇವಲ ಒಂದು ಸಾಫ್ಟ್‌ವೇರ್. ನಿಮಗೆ TypeScript ಗೊತ್ತಿದ್ದಲ್ಲಿ ಬೋಟ್‌ನ Source Code ಅನ್ನು ಪರಿಶೀಲಿಸಿ ಮೇಲಿನ ರೀತಿ ಆಗದೆಂದು ಸ್ವತಃ ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಬಹುದು.", 11 | "autoConversionSaved": "ಉಳಿಸಲಾಗಿದೆ.", 12 | "remainingConversions": "ಬಾಕಿ ಇರುವ ಪರಿವರ್ತನೆಗಳು", 13 | "customApiKeyInstruction": "ಇನ್ನೂ ಹೆಚ್ಚು ಫೈಲ್ ಗಳನ್ನು ಪರಿವರ್ತಿಸಲು /contribute ಮೇಲೆ ಒತ್ತಿರಿ", 14 | "helpmsgFeedback": "ಈ ಬೋಟ್ ನಿಮಗೆ ಇಷ್ಟವಾಯಿತೇ? ಹಾಗಾದರೆ ಇದರ ಡೆವಲಪರ್ ಆದ @KnorpelSenf ಗೆ ತಿಳಿಸಿ ಅಥವಾ ಈ ಚರ್ಚಾ ಗುಂಪನ್ನು ಸೇರಿರಿ - @cloud_convert_bot_lounge!\n\nನಿಮ್ಮ API Key ಸಲ್ಲಿಸಿದರೆ ಅದೇ ನನಗೆ ಧನ್ಯವಾದ ಹೇಳುವ ಅತ್ಯುತ್ತಮವಾದ ರೀತಿ. /contribute\n\nಹಾಗೆಯೇ ನೀವು ಈ ಬೋಟ್ ಅನ್ನು ಭಾಷಾಂತರಿಸಲು ಸಹಾಯ ಮಾಡಬಹುದು.", 15 | "sendApiKey": "ಅದ್ಭುತ! ಈಗ ನನಗೆ ಒಂದು API key ಅನ್ನು ಈ ಸಂದೇಶಕ್ಕೆ ಉತ್ತರವಾಗಿ ಕಳಿಸಿ", 16 | "helpmsgInfo": "ಈ ಆಜ್ಞೆಯನ್ನು ಒಂದು ಫೈಲ್‌ಗೆ ಉತ್ತರವಾಗಿ ಕಳಿಸಿ! ಆ ಫೈಲ್‌ನ ಎಲ್ಲಾ ಮಾಹಿತಿಯನ್ನು(metadata) ನಾನು ಕಳಿಸುತ್ತೇನೆ.", 17 | "helpmsgConvert": "ಈ ಆಜ್ಞೆಯನ್ನು ಒಂದು ಫೈಲ್‌ಗೆ ಉತ್ತರವಾಗಿ ಕಳಿಸಿ! ಆ ಫೈಲ್ ಅನ್ನು ಯಾವ ಫಾರ್ಮ್ಯಾಟ್‌ಗಳಿಗೆ ಪರಿವರ್ತಿಸಬಹುದು ಎಂದು ಹೇಳುತ್ತೇನೆ.", 18 | "helpmsgFile": "ಸರಿ, ಈಗ ನನಗೆ ಕೆಳಗಿನ ಫಾರ್ಮ್ಯಾಟ್‌ಗೆ ಪರಿವರ್ತಿಸಲು ಒಂದು ಫೈಲ್ ಅನ್ನು ಕಳಿಸಿ\n", 19 | "fileInfo": "ನಿಮ್ಮ ಫೈಲ್‌ನ ಬಗ್ಗೆ ಮಾಹಿತಿ ಇಲ್ಲಿದೆ:", 20 | "noFileInfo": "ನಿಮ್ಮ ಫೈಲ್‌ನ ಬಗ್ಗೆ ಯಾವುದೇ ಮಾಹಿತಿ ಲಭ್ಯವಿಲ್ಲ, ಕ್ಷಮಿಸಿ!", 21 | "reset": "ನಿಮ್ಮ ಎಲ್ಲಾ ಸಂರಚನೆಗಳನ್ನು ಅಳಿಸಲಾಗಿದೆ, API key ಸಹಿತ. ನಿಮ್ಮನ್ನು ಬೀಳ್ಕೊಡಲು ದುಃಖ ಆಗುತ್ತಿದೆ! :(\nಯಾವಾಗಲಾದರೂ /contribute ಎಂದು ಕಳಿಸಿ ನಿಮ್ಮ ಉಚಿತ ಪರಿವರ್ತನಾ ನಿಮಿಷಗಳನ್ನು ಪುನಃ ಪಡೆಯಬಹುದು!", 22 | "cancelOperation": "ಕಾರ್ಯಾಚರಣೆಯನ್ನು ರದ್ದುಗೊಳಿಸಿ", 23 | "operationCancelled": "ಕಾರ್ಯಾಚರಣೆಯನ್ನು ರದ್ದುಗೊಳಿಸಲಾಗಿದೆ", 24 | "helpmsgText": "ನನಗೆ ಪಠ್ಯ ಸಂದೇಶಗಳನ್ನು ಪರಿವರ್ತಿಸಲು ಬರುವುದಿಲ್ಲ. ಬದಲಾಗಿ, ಒಂದು ಫೈಲ್ ಅನ್ನು ಪರಿವರ್ತಿಸಲು ಕಳಿಸಿ!", 25 | "helpmsgTextKeySuggestion": "ನನಗೆ ಪಠ್ಯ ಸಂದೇಶಗಳನ್ನು ಪರಿವರ್ತಿಸಲು ಬರುವುದಿಲ್ಲ. ಬದಲಾಗಿ, ಒಂದು ಫೈಲ್ ಅನ್ನು ಪರಿವರ್ತಿಸಲು ಕಳಿಸಿ!\n\nAPI Key ಅನ್ನು ಕಳಿಸಲು ಪ್ರಯತ್ನಿಸುತ್ತಿರುವಿರಾ? ಇದು ಎರಡು ರೀತಿಯಲ್ಲಿ ಮಾಡಬಹುದು. ಯಾವುದಾದರೊಂದು ರೀತಿಯನ್ನು ಆಯ್ಕೆ ಮಾಡಿ:\n೧) ಈ ಮಾದರಿಯಲ್ಲಿ ಒಂದು ಸಂದೇಶವನ್ನು ಕಳಿಸಿ: \"/apikey ABC_YOUR_API_KEY_XYZ”\nಅಥವಾ:\n೨) ಮೊದಲು /apikey ಕಳಿಸಿ. ಅದಕ್ಕೆ ನಾನು ಉತ್ತರಿಸುತ್ತೇನೆ. ನಂತರ ಅದಕ್ಕೆ ನೀವು ನಿಮ್ಮ API Key ಅನ್ನು ಉತ್ತರವಾಗಿ ಕಳಿಸಿ.", 26 | "apiKeyProvided": "API Key ಸಲ್ಲಿಸಿದ್ದಕ್ಕಾಗಿ ಧನ್ಯವಾದಗಳು! ನಿಮ್ಮ ಖಾತೆ ಈಗ ಚಾಲ್ತಿ ಆಗಿದೆ. ಡೀಫಾಲ್ಟ್ ಖಾತೆಯನ್ನು ಬಳಸದೆ ಇರುವುದರಿಂದ ನೀವು ಬೇರೆಯವರಿಗೂ ಈ ಬೋಟ್ ಅನ್ನು ಹೆಚ್ಚು ಸಹಕಾರಿಯಾಗಲು ನೆರವಾಗುತ್ತಿದ್ದೀರಿ!\n\nನಾನು ಒಂದು ಮಾತು ನೀಡಿದ್ದೆ, ಮತ್ತು ನಾನು ನನ್ನ ಮಾತು ಯಾವತ್ತೂ ತಪ್ಪುವುದಿಲ್ಲ! ಆದ್ದರಿಂದ ಇಲ್ಲಿ ನೋಡಿ: ಯಾವಾಗ ನೀವು ಒಂದು ಫೈಲ್ ಒದಗಿಸುವಿರೋ ಆವಾಗ /info ಎಂದು ಕಳಿಸಿ ಆ ಫೈಲ್ ಬಗ್ಗೆ ಇನ್ನಷ್ಟು ಮಾಹಿತಿ ತಿಳಿದುಕೊಳ್ಳಬಹುದು. ಎಚ್ಚರ, ಅವುಗಳಲ್ಲಿ ಬಹಳಷ್ಟು ತಾಂತ್ರಿಕ ಮಾಹಿತಿ ಇರುತ್ತವೆ, ಆದರೆ ನಿಮಗೆ ಗೊತ್ತಿರದ ಕೆಲವು ಆಸಕ್ತಿಕರ ಮಾಹಿತಿ ಸಹ ಇರಬಹುದು. ಎಷ್ಟು ಅದ್ಭುತ ಅಲ್ಲವೇ? ಈಗಲೇ ನೋಡಿ!", 27 | "personalApiKeyInUse": "ನೀವು ಈಗಾಗಲೇ ನಿಮ್ಮ ವ್ಯಕ್ತಿಗತ API Key ಅನ್ನು ನೀಡಿರುವುದರಿಂದ, ನಿಮ್ಮ CloudConvert ಖಾತೆಯನ್ನು ಈ ಚಾಟ್‌ನಲ್ಲಿ ಬಳಸುವೆನು! (ಇದು ನಿಮಗೆ ಒಪ್ಪಿಗೆ ಇಲ್ಲದಿದ್ದಲ್ಲಿ, ನೀವು ಈ ಬೋಟ್ ಅನ್ನು /reset ಮಾಡಬಹುದು.)", 28 | "fileTooBig": "ನೀವು ಕಳಿಸಿದ ಫೈಲ್ ತುಂಬಾ ದೊಡ್ಡದಾಗಿದೆ! /limitations ನೋಡಿ", 29 | "unknownError": "ಏನೋ ಎಡವಟ್ಟು ಆಯಿತು. ಕ್ಷಮಿಸಿ. ನೀವು ನನಗೆ @cloud_convert_bot_lounge ಮೂಲಕ ಸಂಪರ್ಕಿಸಬಹುದು.", 30 | "invalidApiKey": "ನಿಮ್ಮ API Key ಅಮಾನ್ಯವಾಗಿದೆ! ನೀವು /contribute ನಲ್ಲಿರುವ ಎಲ್ಲಾ ಸೂಚನೆಗಳನ್ನು ಪಾಲಿಸಿದಿರಾ?\n\n೧) CloudConvert ಖಾತೆ ಪರಿಶೀಲಿಸಲಾಗಿದೆ ಎಂದು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ. CloudConvert.com ನಲ್ಲಿ ಖಾತೆ ತೆರೆದ ಮೇಲೆ ನಿಮ್ಮ ಈಮೇಲ್ ಖಾತೆಯಲ್ಲಿ ಒಂದು ಲಿಂಕ್ ಬರುವುದು, ಅದನ್ನು ಕ್ಲಿಕ್ ಮಾಡಿ.\n೨) API key ಅನ್ನು ಕಾಪಿ ಪೇಸ್ಟ್ ಮಾಡಿ, ಸ್ವತಃ ಒತ್ತಬೇಡಿ. ಇದರಿಂದ ತಪ್ಪುಗಳು ಆಗಬಹುದು.\n೩) CloudConvert.com ನಲ್ಲಿ ಫೇಸ್‌ಬುಕ್ ಲಾಗಿನ್ ಬಳಸಬೇಡಿ, ಗೂಗಲ್ ಲಾಗಿನ್ ಬಳಸಿ.\n೪) ಇದ್ಯಾವುದೂ ಕೆಲಸ ಮಾಡದಿದ್ದಲ್ಲಿ, API Key ಅನ್ನು Dashboard ನಲ್ಲಿ ಪುನರ್ ಉತ್ಪಾದಿಸಿ ಮತ್ತು /contribute ಒತ್ತಿ.\n\nಮಾನ್ಯವಾದ Key ಒದಗಿಸಿದ ಮೇಲೆ, ನೀವು ಮನಸ್ಸು ಬದಲಾಯಿಸಿದ ಪಕ್ಷದಲ್ಲಿ /reset ಒತ್ತಿ ನಮ್ಮ ಡೀಫಾಲ್ಟ್ ಖಾತೆಗೆ ಮರಳಬಹುದು.\n\nನೀವು ಸಲ್ಲಿಸಿದ ಅಮಾನ್ಯ API Key ಇದಾಗಿದೆ:\n", 31 | "noMoreConversionMinutes": "ಯಾವುದೇ ಉಚಿತ ಪರಿವರ್ತನೆಗಳು ಉಳಿದಿಲ್ಲ! /balance ನೋಡಿ!\n\nನಿಮಗೆ ಸ್ವಯಂಚಾಲಿತವಾಗಿ ೨೫ ಉಚಿತ ಪರಿವರ್ತನೆಗಳನ್ನು ಇನ್ನು ೨೪ ಗಂಟೆಗಳಲ್ಲಿ ಒದಗಿಸಲಾಗುವುದು. ನಿಮಗೆ ಕಾಯಲು ಇಷ್ಟವಿಲ್ಲದ ಪಕ್ಷದಲ್ಲಿ, /contribute ಕ್ಲಿಕ್ ಮಾಡಿ ಸೂಚನೆಗಳನ್ನು ಓದಿರಿ.", 32 | "listFormats": "ಅದ್ಭುತ! ಈ ${filetype} ಅನ್ನು ಕೆಳಗಿನ ಫಾರ್ಮ್ಯಾಟ್‌ಗಳಿಗೆ ಪರಿವರ್ತಿಸ ಬಲ್ಲೆನು:", 33 | "autoConvert": "${from} ಇಂದ ${to} ಗೆ ಸ್ವಯಂ-ಪರಿವರ್ತಿಸಿ", 34 | "pickLanguage": "ನಿಮ್ಮ ಭಾಷೆ ಬದಲಿಸಲು ಕೆಳಗಿನ ಯಾವುದಾರೊಂದು ಬಟನ್ ಗಳನ್ನು ಒತ್ತಿರಿ.\n\nಬೇರೆ ಭಾಷೆ ಮಾತಾಡುವವರು ನೀವಾಗಿದ್ದಲ್ಲಿ ಅಥವಾ ಏನಾದರೂ ತಪ್ಪು ಕಂಡುಬಂದಲ್ಲಿ ಈ ಬೋಟ್ ಅನ್ನು ಭಾಷಾಂತರಿಸಲು ಸಹಾಯ ಮಾಡಿ! ಇಲ್ಲಿ ಕ್ಲಿಕ್ ಮಾಡಿ - ಭಾಷಾಂತರಿಸಿ!", 35 | "languageName": "🇮🇳 ಕನ್ನಡ", 36 | "resultFileTooBig": "ಪರಿವರ್ತಿತ ಫೈಲ್ ತುಂಬಾ ದೊಡ್ಡದಾಗಿದೆ! /limitations ನೋಡಿ" 37 | } -------------------------------------------------------------------------------- /src/bot/controllers/file-controller.ts: -------------------------------------------------------------------------------- 1 | import d from 'debug' 2 | import path from 'path' 3 | import * as util from '../helpers/get-file-extension' 4 | import { 5 | autoConversionReplyMarkup, 6 | cancelOperationReplyMarkup, 7 | } from '../helpers/reply-markup-builder' 8 | import { AutoFileConversion } from '../models/file-conversion' 9 | import TaskContext from '../models/task-context' 10 | import * as cloudconvert from './../models/cloud-convert' 11 | import * as controllerUtils from './controller-utils' 12 | const debug = d('bot:contr:file') 13 | 14 | async function convertFile( 15 | ctx: TaskContext, 16 | fileId: string, 17 | targetFormat: string, 18 | fileName?: string 19 | ): Promise { 20 | debug('Converting file to ', targetFormat, fileId, targetFormat) 21 | if (ctx.message !== undefined) { 22 | let fileUrl: string 23 | try { 24 | fileUrl = await ctx.telegram.getFileLink(fileId) 25 | } catch (e) { 26 | if (e.code === 400) { 27 | await ctx.reply(ctx.i18n.t('fileTooBig')) 28 | } else { 29 | d('err')(e) 30 | await ctx.reply(ctx.i18n.t('unknownError')) 31 | } 32 | return 33 | } 34 | 35 | // Get info and convert file, show :thinking_face: in the meantime 36 | const thinkingMessage = await ctx.reply( 37 | String.fromCodePoint(0x1f914) /* <- thinking face emoji */, 38 | { 39 | // eslint-disable-next-line @typescript-eslint/camelcase 40 | reply_to_message_id: ctx.message.message_id, 41 | } 42 | ) 43 | 44 | fileName = fileName || path.basename(fileUrl) 45 | const extension = '.' + targetFormat 46 | if (!fileName.endsWith(extension)) { 47 | fileName += extension 48 | } 49 | 50 | const session = await ctx.session 51 | 52 | let stream: NodeJS.ReadableStream 53 | try { 54 | stream = await cloudconvert.convertFile( 55 | fileUrl, 56 | targetFormat, 57 | fileName, 58 | session.api_key 59 | ) 60 | } catch (e) { 61 | if (e.code === undefined || typeof e.code !== 'number') { 62 | d('err')(e) 63 | await ctx.reply(ctx.i18n.t('unknownError')) 64 | } else { 65 | await ctx.reply(cloudconvert.describeErrorCode(ctx, e)) 66 | } 67 | return 68 | } finally { 69 | if (thinkingMessage) { 70 | ctx.telegram.deleteMessage( 71 | ctx.message.chat.id, 72 | thinkingMessage.message_id 73 | ) 74 | } 75 | } 76 | 77 | // Upload file, send chat action in the meantime 78 | ctx.replyWithChatAction('upload_document') 79 | const handle = setInterval(() => { 80 | ctx.replyWithChatAction('upload_document') 81 | }, 5000) 82 | const sourceFormat = util.ext(fileUrl) 83 | const conversion: AutoFileConversion = { 84 | from: sourceFormat, 85 | to: targetFormat, 86 | auto: 87 | session.auto !== undefined && 88 | session.auto.some( 89 | c => c.from === sourceFormat && c.to === targetFormat 90 | ), 91 | } 92 | try { 93 | await ctx.replyWithDocument( 94 | { source: stream, filename: fileName }, 95 | { 96 | // eslint-disable-next-line @typescript-eslint/camelcase 97 | reply_to_message_id: ctx.message.message_id, 98 | // eslint-disable-next-line @typescript-eslint/camelcase 99 | reply_markup: autoConversionReplyMarkup(ctx, conversion), 100 | } 101 | ) 102 | } catch (e) { 103 | if (e.code === 413) { 104 | await ctx.reply(ctx.i18n.t('resultFileTooBig')) 105 | } else { 106 | d('err')(e) 107 | await ctx.reply(ctx.i18n.t('unknownError')) 108 | } 109 | return 110 | } finally { 111 | clearInterval(handle) 112 | } 113 | ctx.db.collection('stats').add({ 114 | ...conversion, 115 | // eslint-disable-next-line @typescript-eslint/camelcase 116 | chat_id: ctx.message.chat.id, 117 | date: new Date(), 118 | }) 119 | } 120 | } 121 | 122 | export async function setSourceFile( 123 | ctx: TaskContext, 124 | fileId: string, 125 | fileName?: string 126 | ): Promise { 127 | if (ctx.message !== undefined) { 128 | const session = await ctx.session 129 | // eslint-disable-next-line @typescript-eslint/camelcase 130 | session.task = { file_id: fileId } 131 | if (fileName !== undefined) { 132 | // eslint-disable-next-line @typescript-eslint/camelcase 133 | session.task.file_name = fileName 134 | } 135 | await controllerUtils.printPossibleConversions(ctx, fileId) 136 | } 137 | } 138 | 139 | async function handleFile( 140 | ctx: TaskContext, 141 | fileId: string, 142 | fileName?: string 143 | ): Promise { 144 | if (ctx.message !== undefined) { 145 | // Do not try to convert file to format specified in reply 146 | // as this would be counter-intuitive. 147 | 148 | const session = await ctx.session 149 | 150 | const conversions: Array> = [] 151 | // Perform all auto-conversions 152 | if (session.auto !== undefined && session.auto.length > 0) { 153 | let fileUrl: string 154 | try { 155 | fileUrl = await ctx.telegram.getFileLink(fileId) 156 | } catch (e) { 157 | if (e.code === 400) { 158 | await ctx.reply(ctx.i18n.t('fileTooBig')) 159 | } else { 160 | d('err')(e) 161 | await ctx.reply(ctx.i18n.t('unknownError')) 162 | } 163 | return 164 | } 165 | const ext = util.ext(fileUrl) 166 | conversions.push( 167 | ...session.auto 168 | .filter(c => c.from === ext) 169 | .map(c => convertFile(ctx, fileId, c.to, fileName)) 170 | ) 171 | } 172 | 173 | // Perform one-time conversion 174 | let performedOneTimeConversion = false 175 | if (ctx.command !== undefined) { 176 | // Try to convert file to format specified in caption 177 | const targetFormat = ctx.command.command 178 | conversions.push(convertFile(ctx, fileId, targetFormat, fileName)) 179 | performedOneTimeConversion = true 180 | } else if (session.task?.target_format !== undefined) { 181 | // Try to convert file to format specified in db 182 | conversions.push( 183 | convertFile(ctx, fileId, session.task.target_format, fileName) 184 | ) 185 | performedOneTimeConversion = true 186 | } 187 | if (performedOneTimeConversion) { 188 | // Clear the task if any of the two above were performed 189 | delete session.task 190 | } 191 | 192 | if (conversions.length > 0) { 193 | await Promise.all(conversions) 194 | } else if (ctx.message.chat.type === 'private') { 195 | // No target format yet, list conversion options 196 | await setSourceFile(ctx, fileId, fileName) 197 | } 198 | } 199 | } 200 | 201 | export async function handleTextMessage( 202 | ctx: TaskContext, 203 | next: (() => any) | undefined 204 | ): Promise { 205 | if (ctx.message !== undefined && ctx.command !== undefined) { 206 | const session = await ctx.session 207 | 208 | const targetFormat = ctx.command.command.replace(/_/g, '.') 209 | 210 | // Try to convert file in reply 211 | const replyFile = await controllerUtils.getFileIdFromReply(ctx) 212 | if (replyFile !== undefined) { 213 | await convertFile( 214 | ctx, 215 | replyFile.file_id, 216 | targetFormat, 217 | replyFile.file_name 218 | ) 219 | delete session.task 220 | return 221 | } 222 | 223 | // Try to convert file stored by id in db 224 | if (session.task?.file_id !== undefined) { 225 | await convertFile( 226 | ctx, 227 | session.task.file_id, 228 | targetFormat, 229 | session.task.file_name 230 | ) 231 | delete session.task 232 | return 233 | } 234 | 235 | // No file yet, send instruction to send file 236 | // eslint-disable-next-line @typescript-eslint/camelcase 237 | session.task = { target_format: targetFormat } 238 | await ctx.replyWithHTML( 239 | ctx.i18n.t('helpmsgFile') + targetFormat + '!', 240 | { 241 | // eslint-disable-next-line @typescript-eslint/camelcase 242 | reply_markup: cancelOperationReplyMarkup(ctx), 243 | } 244 | ) 245 | } else if (next !== undefined) { 246 | return next() 247 | } 248 | } 249 | 250 | export async function handleDocument(ctx: TaskContext): Promise { 251 | if (ctx.message !== undefined) { 252 | const file: { file_id: string; file_name?: string } | undefined = 253 | ctx.message.audio || 254 | ctx.message.animation || 255 | ctx.message.document || 256 | ctx.message.sticker || 257 | ctx.message.video || 258 | ctx.message.voice || 259 | ctx.message.video_note 260 | if (file !== undefined) { 261 | await handleFile(ctx, file.file_id, file.file_name) 262 | } 263 | } 264 | } 265 | 266 | export async function handlePhoto(ctx: TaskContext): Promise { 267 | if (ctx.message?.photo !== undefined && ctx.message.photo.length > 0) { 268 | const file = ctx.message.photo[ctx.message.photo.length - 1] 269 | await handleFile(ctx, file.file_id) 270 | } 271 | } 272 | -------------------------------------------------------------------------------- /src/bot/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKeyProvided": "¡Gracias por proporcionar la clave API! Su propia cuenta ya está lista y configurada. ¡Al no confiar más en la cuenta predeterminada, ayudas a que el bot sea más útil para todos!\n\n¡Prometí revelar un comando de bot oculto, y me gusta cumplir las promesas! Aquí vamos: cada vez que proporcionó un archivo, envíe /info para obtener información detallada sobre sus archivos. Cuidado, muchas cosas son bastante técnicas allí, pero también hay un montón de datos interesantes que probablemente no sabías. ¡Qué asombroso es eso! ¡Échale un vistazo!\n\n", 3 | "autoConversionSaved": "Guardado.", 4 | "autoConvert": "convertir automáticamente ${from} a ${to}", 5 | "cancelOperation": "Cancelar operación", 6 | "customApiKeyInstruction": "¿Necesitas realizar más conversiones? /contribute", 7 | "fileInfo": "Aquí está la información de su archivo:", 8 | "fileTooBig": "¡El archivo es demasiado grande! Ver /limitations", 9 | "helpmsgBalanceWithApiKey": "¡Hurra! ¡Has conectado tu cuenta personal de Cloud Convert con este bot! ¡Gracias! Puede consultar su saldo con / balance. Conectó este bot al proporcionar la siguiente clave API (¡gracias!):", 10 | "helpmsgBuyMinutes": "Antranix, hace 1 minuto Si necesita realizar aún más conversiones, puede comprar minutos de conversión en www.cloudconvert.com. Este bot los usará automáticamente si está disponible. Sin embargo, recuerde que este proyecto fue creado por un solo estudiante en la Universidad de Kiel. Aunque hice todo lo posible para mantener este software libre de errores y lo más confiable posible, no puedo garantizar que este bot no esté consumiendo accidentalmente todos sus minutos de conversión, matando a su gatito o algo similar. . Nunca ha sucedido hasta ahora y lo considero muy poco probable, pero sigue siendo un software, por lo que nunca se sabe. Si conoce TypeScript, puede consultar el código fuente para verificar que algo tan malo como esto nunca sucederá.", 11 | "helpmsgConvert": "Utilice este comando en respuesta a un archivo! Luego enumeraré todas las conversiones posibles para eso.", 12 | "helpmsgFeedback": "¿Te gusta este bot? ¡Dígale al desarrollador @KnorpelSenf o comparta sus pensamientos en el grupo de discusión en @cloud_convert_bot_lounge!\n\nLa mejor manera de decir gracias es proporcionando una clave API. /contribuir También puede ayudar a traducir este bot.", 13 | "helpmsgFile": "Bien, ahora envíame un archivo para convertir", 14 | "helpmsgGroups": "¡Hola!\n¡Mi nombre es Cloud Convert Bot y puedo ayudarlo con las conversiones de archivos!\nNo le enviaré correos no deseados con ningún mensaje o archivo convertido (a menos que lo pida amablemente). Hay dos formas de decirme que debo convertir un archivo para usted:\n  1) Responder a un archivo que alguien envía. Responda con el formato de destino directamente (p. Ej. / Mp4) o envíe /convert para ver los posibles formatos. Usaré el archivo más reciente si no presiona responder por ningún mensaje.\n  2) Enviar un título cuando envíe el archivo, e. sol. /mp4 para convertir a MP4.\n\nUna vez que se completa la conversión, puede habilitar conversiones automáticas. Si habilita las conversiones automáticas para un tipo de archivo, repetiré automáticamente esta conversión para todos los archivos del mismo tipo.\n\nLa característica más impresionante es que puede configurar su propia cuenta. Este bot puede funcionar durante un tiempo sin una cuenta, pero si usa el bot regularmente, configurar una cuenta es realmente importante porque puede obtener muchas más conversiones gratuitas como esa. Configurar con /contribute. De esta manera, puede evitar algunas /limitations y también contribuir a este bot (que es realmente útil).\n\nTenga en cuenta que todos los comandos en este chat grupal deben terminar en \"@cloud_convert_bot\", de lo contrario, los ignoraré (por ejemplo, no /mp4 pero /mp4@cloud_convert_bot).", 15 | "helpmsgInfo": "Utilice este comando en respuesta a un archivo! Luego le contaré toda la información del archivo (metadatos) que conozco.", 16 | "helpmsgLimitations": "Actualmente hay dos limitaciones. Primero:solo puede convertir algunos archivos al día. Segundo: sólo puede convertir archivos de un tamaño determinado.\n\nDebido a que todos los usuarios de este bot comparten un grupo común de 25 conversiones por día y otros usuarios pueden consumir sus conversiones (verifique el saldo con /balance), a veces no puede convertir ningún archivo en absoluto. Lo bueno es: simplemente necesita configurar una cuenta y BOOM, ¡este límite se ha ido! Ver /contribute para eso!\n\nTelegram no permite que los bots (como yo) descarguen archivos con más de 20 MB de tamaño o carguen archivos con más de 50 MB de tamaño. Este límite no se puede cambiar. Si necesita convertir archivos más grandes, puede visitar cloudconvert.com. ¡Lo siento!", 17 | "helpmsgPrivate": "¡Hola! Soy un convertidor de archivos bot. Admito 218 formatos de archivo diferentes y sé cómo manejar medios de cualquier tipo (archivos de audio, documentos, GIF, fotos, stickers, videos, notas de voz y notas de video).\n\nIMPORTANTE: Puedes probar de forma gratuita. Si necesitas convertir sólo un archivo, simplemente adelante y hazlo. Sin embargo, este bot es un proyecto comunitario. Si desea utilizar este bot con más frecuencia, contribuya proporcionando una clave API: ver /contribute. Esto solo toma 30 segundos y es muy simple. Serás recompensado con 25 conversiones adicionales gratis cada día. Se trata de configurar una cuenta. (No te preocupes, es gratis para siempre).\n\n¡También soportó conversiones automáticas de archivos (incluso en chats grupales)! Habilite las conversiones automáticas si tiene muchos archivos del mismo tipo para convertir. Puede habilitar las conversiones automáticas tan pronto como convierta un archivo.\n\nPuede configurar el idioma con /language.\n\nRecuerda que este bot no funcionaría sin los muchos contribuyentes que tiene, ¡conviértete en uno de ellos! /contribute\n\nGrupo de discusión: @cloud_convert_bot_lounge\nCanal de noticias: @cloud_convert_bot_news", 18 | "helpmsgSetUpAccount": "¡Bienvenido, futuro colaborador de bot! ¡Al contribuir al bot, puede reclamar sus propias 25 conversiones adicionales gratis por día ! Nadie más podrá impactar este contador. No tendrá que pagar nada por esto y funciona completamente sin brujería. Todo lo que necesita hacer es seguir estos tres pasos: \n1) Cree su propia cuenta de Cloud Convert aqu .\n2) Visite el tablero y copie la clave API.\n3)Regrese a este chat y envíe /apikey. Pegue la clave API en este chat.\n¡Buen trabajo! ¡Ahora cada operación de este bot funcionará en función de su nueva cuenta de Cloud Convert! Restablecer el bot con / reset borra la clave API de nuestra base de datos. Una vez que me envíes tu clave de API, ¡te diré un comando de bot secreto como regalo de agradecimiento!\n\nTenga en cuenta que ni este bot ni su desarrollador están asociados de ninguna manera con cloudconvert.com. Las personas detrás de ese sitio solo ofrecen conversiones de archivos gratuitas y tienen una forma ordenada de conectar bots a ese servicio. Tienen su sede en Múnich, Alemania, y no necesita preocuparse por preocupaciones de privacidad o anuncios o porquería \"te extrañamos\" una vez que se haya registrado. Recuerde que conectar su propia cuenta a este bot es muy importante para que este bot funcione.", 19 | "helpmsgStartGroups": "¡Hola! ¡Mi nombre es Cloud Convert Bot y puedo ayudarlo con las conversiones de archivos! Escriba /help para un recorrido rápido, configure su idioma con /language, y no olvide configurar su cuenta: /contrib", 20 | "helpmsgStartPrivate": " ¡Hola! ¡Puedo ayudarte con las conversiones de archivos! Por favor envíeme su archivo para convertir /help", 21 | "helpmsgText": "No puedo convertir mensajes de texto. En cambio, ¡envíeme un archivo para convertirlo!", 22 | "helpmsgTextKeySuggestion": "No puedo convertir mensajes de texto. En cambio, ¡envíeme un archivo para convertirlo!\n\n¿Estás intentando enviar tu clave API? Esto es posible de dos maneras. No importa cuál elijas. Tu también puedes:\n1) Envíe el mensaje en el siguiente formato: \"/apikey ABC_YOUR_API_KEY_XYZ\"\nO también puedes:\n2) Primero envíe solo \"/apikey\". Yo responderé a eso. En segundo lugar, utilice la función de respuesta de Telegram para responder a mi mensaje cuando, a su vez, envíe su clave API.\n", 23 | "invalidApiKey": "¡Tu clave API no es válida! ¿Seguiste los pasos bajo /contribute?\n\n1) No escriba la clave API usted mismo, ya que podría haber un error tipográfico. En su lugar, copie y pegue la clave API del sitio web directamente.\n2) No use el inicio de sesión de Facebook en www.cloudconvert.com. Use un correo electrónico en su lugar. El inicio de sesión de Google también debería funcionar.\n3) Si nada funciona, puede volver a generar la API en el panel e intentar / contribuir nuevamente.\n\nUna vez que proporcionó una clave válida, siempre puede optar por no participar nuevamente y volver a usar la cuenta compartida entre todos los usuarios de bot. Para hacerlo, simplemente reinicie el bot con /reset. \n\nEsta es la clave API no válida que proporcionó:", 24 | "languageName": "🇪🇸 Español", 25 | "listFormats": "¡Increíble! Puedo convertir este ${filetype} a:", 26 | "noFileInfo": "No pude encontrar ningún metadato sobre su archivo, lo siento.", 27 | "noMoreConversionMinutes": "¡Parece que no quedan conversiones gratuitas! Cheque /balance!\n\nSe le proporcionarán automáticamente 25 conversiones gratuitas más en las próximas 24 horas. Si no quiere esperar, puede convertir su archivo ahora mismo. Solo necesita seguir los pasos bajo /contribute.", 28 | "operationCancelled": "Operación cancelada.", 29 | "personalApiKeyInUse": "Como ya proporcionó su clave API personal, ¡también usaré su cuenta de CloudConvert en este chat! ¡Hurra! (Si no desea esto, puede restablecer el bot en este chat).", 30 | "pickLanguage": "Configure su idioma usando uno de los botones a continuación. ¿Habla otro idioma? ¿Encontraste un error tipográfico? ¡Ayuda a traducir este bot! ¡Simplemente haga clic en este enlace!", 31 | "remainingConversions": "Conversiones restantes", 32 | "reset": "Restablecer toda su configuración, incluida la clave API. ¡Siento verte ir! :( ¡Siempre puede recuperar sus minutos de conversión gratis enviando /contribute!", 33 | "resultFileTooBig": "¡El archivo de resultados es demasiado grande! Ver /limitations", 34 | "sendApiKey": "¡Perfecto! ¡Ahora envíeme la clave API en respuesta a este mensaje!", 35 | "unknownError": "Algo salió mal. Lo siento por eso. Puede escribirme en @cloud_convert_bot_lounge debido a esto.", 36 | "validatingApiKey": "Validando..." 37 | } -------------------------------------------------------------------------------- /src/bot/locales/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKeyProvided": "Danke, dass du den API-Schlüssel eingereicht hast! Dein Konto ist jetzt bereit und alles ist fertig. Indem du nicht mehr das Standardkonto benutzt, machst du den Bot für alle anderen da draußen auch besser!\n\nIch hatte einen geheimen Bot-Befehl versprochen, und daran halte ich mich natürlich! Bitte sehr: Wenn du eine Datei geschickt hast, schreib /info, um detaillierte Informationen darüber zu erhalten. Vorsicht, das könnte alles ziemlich technisch aussehen, aber da sind auch ein paar super interessante Infos dabei. Wie geil ist das denn bitte?! Probier das gleich mal aus!", 3 | "autoConversionSaved": "Gespeichert.", 4 | "autoConvert": "${from} zu ${to} automatisch", 5 | "cancelOperation": "Abbrechen", 6 | "customApiKeyInstruction": "Brauchst du mehr Umwandlungen? /contribute", 7 | "fileInfo": "Hier sind die Infos:", 8 | "fileTooBig": "Diese Datei ist zu groß! Siehe /limitations", 9 | "helpmsgBalanceWithApiKey": "Yay! Du hast dein persönliches Konto bei Cloud Convert mit diesem Bot verbunden! Danke sehr! Du kannst deinen Kontostand mit /balance überprüfen.\n\nDiesen Schlüssel hier hast du eingereicht (danke!):", 10 | "helpmsgBuyMinutes": "Falls du noch mehr Dateien umwandeln willst, kannst du bei www.cloudconvert.com Minuten dafür kaufen. Dieser Bot wird sie dann automatisch verwenden. Denk aber dran, dass das hier ein Projekt eines einzelnen Studenten von der Kieler Uni ist. Auch wenn ich alles darangesetzt habe, dass diese Software keine Fehler hat, kann ich natürlich nicht garantieren, dass dieser Bot nicht versehentlich alle Minuten aufbraucht, deine Babykätzchen umbringt oder sonst was. Das ist bisher noch nie passiert und ich halte es auch für unwahrscheinlich, aber es ist immer noch Software, also weiß man nie so genau. Falls du TypeScript beherrschst, kannst du dir den Quelltext ansehen, um sicherzugehen, dass sowas schlimmes nie passieren wird.", 11 | "helpmsgConvert": "Benutz dieser Befehl mit der Antwortfunktion für eine Datei! Ich schicke dir dann eine Liste mit möglichen Umwandlungen dafür.", 12 | "helpmsgFeedback": "Gefällt dir dieser Bot? Lass dem Entwickler @KnorpelSenf einen Dankesgruß da oder teile deine Gedanken in der Diskussionsgruppe unter @cloud_convert_bot_lounge!\n\nDie beste Art, um Danke zu sagen, ist die Beisteuerung eines API-Schlüssels. /contribute\nDu kannst auch bei der Übersetzung mithelfen.", 13 | "helpmsgFile": "Alles klaro, jetzt schick mir die Datei zur Umwandlung nach ", 14 | "helpmsgGroups": "Hi zusammen!\nIch heiße Cloud Convert Bot und ich kann Dateien umwandeln!\nIch nerve euch hier weder mit Nachrichten noch mit Dateien (nur wenn ihr lieb bittet). Ihr könnt mir auf zwei Arten sagen, dass ich eine Datei für euch umwandeln soll:\n 1) Antwortet auf eine geschickte Datei mit dem Zielformat, z. B. /mp4 oder schreibt /convert, um alle möglichen Zielformate zu sehen. Falls ihr die Antwort-Funktion nicht benutzt, gehe ich davon aus, dass die zuletzt geschickte Datei gemeint ist.\n 2) Schreibt einen Untertitel wenn ihr eine Datei schickt, z. B. /mp4, um zu MP4 umzuwandeln.\n\nSobald die Umwandlung fertig ist, könnt ihr automatische Umwandlungen aktivieren. Dann wiederhole ich die entsprechende Aufgabe, wann immer eine Datei des gleichen Typs geschickt wird.\n\nDas beste ist die Erstellung eines Kontos. Vielleicht funktioniert dieser Bot eine Zeit lang ohne, aber wenn ich hier regelmäßig gebraucht werde, ist das sehr wichtig, weil ihr dann jeden Tag super viele Umwandlungen gratis bekommt. Schreibt dafür /contribute. So kommt ihr um die Einschränkungen (s. /limitations) herum und tragt gleichzeitig etwas zu diesem Bot bei (was wirklich hilfreich ist).\n\nDenkt dran, dass alle Befehle in dieser Gruppe auf „@cloud_convert_bot“ enden müssen, sonst ignoriere ich sie (also /mp4@cloud_convert_bot statt /mp4)!", 15 | "helpmsgInfo": "Benutz diesen Befehl mit der Antwortfunktion für eine Datei! Ich schreibe dir dann alle Datei-Informationen (Meta-Daten), die ich herausfinden kann.", 16 | "helpmsgLimitations": "Zurzeit gibt es zwei Einschränkungen. Einerseits kann man nur ein paar Dateien am Tag umwandeln. Andererseits gibt es eine maximale Dateigröße.\n\nDa sich alle Nutzer dieses Bots 25 Umwandlungen pro Tag teilen müssen (Kontostand mit /balance abfragen), kann es vorkommen, dass du davon nichts abbekommst und an einigen Tagen gar keine Datei umwandeln kannst. ABER das Gute ist, dass du einfach ein Konto erstellen kannst und ZACK ist diese Einschränkung aufgehoben! Schreib dafür /contribute!\n\nTelegram verbietet Bots (wie mir), Dateien mit mehr als 20 MB herunterzuladen oder mit mehr als 50 MB hochzuladen. Daran kann man nichts ändern. Falls deine Datei größer ist als das, musst du wohl cloudconvert.com selbst besuchen. Sorry!", 17 | "helpmsgPrivate": "Hi! Ich bin ein Bot, der 218 Dateiformate ineinander umwandeln kann. Ich komme mit Medien jeder Art klar (Musikdateien, Dokumente, GIFs, Fotos, Sticker, Videos, Sprachnachrichten und Videonachrichten).\n\nACHTUNG: Du kannst mich kostenlos ausprobieren. Falls du nur fix diese eine Datei umwandeln willst, mach das einfach. Anderfalls gilt: Dieser Bot ist ein Gemeinschaftsprojekt. Wenn du mich regelmäßig verwendest, steuere bitte deinen Teil dazu bei, indem du einen API-Schlüssel einreichst: siehe /contribute. Das dauert nur 30 Sekunden und ist super simpel. Dafür bekommst du auch 25 Extra-Umwandlungen gratis jeden Tag. Du musst dafür ein Konto erstellen. (Keine Sorge, kostet auch nix.)\n\nIch kann Dateien auch automatisch umwandeln (selbst in Gruppenchats)! Das kannst du aktivieren, wenn du wirklich viele Dateien desselben Typs umwandeln willst. Du kannst die Funktion nutzen, nachdem du die erste der Dateien umgewandelt hast.\n\nDu kannst die Sprache mit /language ändern.\n\nDenk dran, dass dieses Projekt nur durch die vielen Unterstützer am Leben gehalten wird – sei einer davon! /contribute\n\nDiskussionsgruppe: @cloud_convert_bot_lounge\nNachrichtenkanal: @cloud_convert_bot_news", 18 | "helpmsgSetUpAccount": "Willkommen, zukünftiger Beitragender!\nIndem du etwas zu diesem Bot beisteuerst, bekommst du 25 Extra-Umwandlungen gratis jeden Tag! Niemand sonst hat Einfluss auf diesen Wert. Das kostet alles nix und ist auch kein Hexenwerk. Befolg einfach diese drei Schritte:\n1) Registriere dich hier bei Cloud Convert.\n2) Geht zum Dashboard und kopiere den API-Schlüssel.\n3) Komm hierher zurück und sende /apikey. Füge den API-Schlüssel hier ein.\nGut gemacht! Jetzt laufen alle Sachen hier über dein neues Konto bei Cloud Convert! Mit /reset setzt du den Bot zurück und löschst den API-Schlüssel aus der Datenbank. Sobald du mir den Schlüssel geschickt hast, bekommst du sogar noch einen geheimen Bot-Befehl als kleines Dankeschön!\n\nÜbrigens ist weder dieser Bot noch der Entwickler irgendwie mit Cloud Convert verbandelt. Die Leute dort stellen einfach kostenlose Datei-Umwandlungen bereit und Bots lassen sich da sehr leicht andocken. Die sitzen in München und entsprechend muss man sich auch keine Sorgen um Datenschutz oder „Wir vermissen dich”-Nachrichten machen, wenn man sich da registriert. Denk dran, dass das für diesen Bot sehr wichtig ist, dass du dich da anmeldest.", 19 | "helpmsgStartGroups": "Hi!\nIch heiße Cloud Convert Bot und ich kann Dateien umwandeln! Schreibt /help für eine kleine Einführung, stellt die Sprache mit /language um – und denkt daran, euer Konto einzurichten: /contribute", 20 | "helpmsgStartPrivate": "Hi!\nIch helfe dir beim Umwandeln von Dateien!\nSchick mir einfach deine Datei. /help", 21 | "helpmsgText": "Ich kann keine Textnachrichten umwandeln. Schick mir stattdessen eine Datei!", 22 | "helpmsgTextKeySuggestion": "Ich kann keine Textnachrichten umwandeln. Schick mir stattdessen eine Datei!\n\nVersuchst du gerade, einen API-Schlüssel einzureichen? Das geht auf zwei Wegen, die beide zu demselben Ziel führen. Es ist völlig egal, welchen du wählst. \n1) Entweder kannst du mir die Nachricht in dem Format „/apikey ABC_DEIN_API_SCHL_SSEL_XYZ“ schicken,\n2) oder du kannst genausogut erst nur „/apikey“ schicken. Ich antworte dann darauf. Verwende daraufhin die Antwortfunktion von Telegram und antworte mit deinem API-Schlüssel auf meine Nachricht.", 23 | "invalidApiKey": "Dieser API-Schlüssel ist ungültig! Hast du die Schritte unter /contribute befolgt?\n\n1) Versichere dich, dass du dein Konto bei CloudConvert verifiziert hast, indem du auf den Link in der Bestätigungs-E-Mail geklickt hast, die du nach der Registrierung erhalten hast.\n2) Schreib den API-Schlüssel nicht selbst ab, da dann Tippfehler auftreten. Mach das besser über Kopieren & Einfügen direkt aus der Webseite heraus.\n3) Erstell dein Konto bei www.cloudconvert.com nicht via Facebook-Login. Nimm stattdessen E-Mail. Google müsste auch gehen.\n4) Falls gar nichts davon klappt, kannst du den API-Schüssel auf dem Dashbord auch neu erzeugen lassen und dann noch einmal /contribute probieren.\n\nSobald du den API-Schlüssel eingereicht hast, kannst du den jederzeit wieder zurückziehen und zum Standard-Konto zurückkehren. Schreib dafür einfach /reset.\n\nDiesen API-Schlüssel wolltest du einreichen:", 24 | "languageName": "🇩🇪 Deutsch", 25 | "listFormats": "Ausgezeichnet! Ich kann ${filetype} umwandeln zu:", 26 | "noFileInfo": "Ich konnte dazu leider keine Meta-Daten finden, sorry!", 27 | "noMoreConversionMinutes": "Sieht aus, als hättest du keine Umwandlungen mehr über! Siehe /balance\n\nDu bekommst automatisch weitere 25 Umwandlungen innerhalb der nächsten 24 Stunden. Wenn du nicht warten willst, kannst du die Datei auch sofort umwandeln. Folg dazu einfach den Schritten unter /contribute.", 28 | "operationCancelled": "Operation abgebrochen.", 29 | "personalApiKeyInUse": "Da du bereits einen API-Schlüssel eingereicht hast, werde ich das Konto bei Cloud Convert auch in diesem Chat verwenden! (Falls du das nicht willst, kannst du den Bot hier zurücksetzen.)", 30 | "pickLanguage": "Stell deine Sprache mit den Knöpfen unten ein.\n\nSprichst du eine andere Sprache? Hast du einen Tippfehler gefunden? Hilf bei der Übersetzung! Klick einfach auf diesen Link!", 31 | "remainingConversions": "Verbleibende Umwandlungen", 32 | "reset": "Ich habe alle deine Einstellungen aus der Datenbank gelöscht, inklusive API-Schlüssel. Schade, dass du gehst :(\nDu kannst dir deine kostenlosen Umwandlungen jederzeit mit /contribute wieder zurückholen!", 33 | "resultFileTooBig": "Die resultierende Datei ist zu groß! Siehe /limitations", 34 | "sendApiKey": "Perfekt! Schick mir jetzt deinen API-Schlüssel als Antwort auf diese Nachricht!", 35 | "unknownError": "Da ist was schiefgelaufen. Entschuldige. Du kannst dich gerne in @cloud_convert_bot_lounge darüber beschweren.", 36 | "validatingApiKey": "Überprüfen …" 37 | } -------------------------------------------------------------------------------- /src/bot/locales/ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "helpmsgStartPrivate": "Привет!\nЯ могу помочь тебе с конвертацией файла!\nПожалуйста, отправь файл для конвертации. /help", 3 | "helpmsgPrivate": "Привет! Я бот-конвертатор файлов. Я поддерживаю 218 различных форматов файлов и знаю, как работать с любыми носителями (аудиофайлы, документы, гифки, фотографии, стикеры, видеозаписи, голосовые заметки, и видеозаписи).\n\nВажно!: Вы можете попробовать меня бесплатно. Если вам нужно конвертировать только один файл, просто сделайте это. Однако Этот бот является проектом сообщества. Если вы хотите использовать этого бота чаще, внесите свой вклад, предоставив ключ API: см. раздел /contribute. Это займет всего 30 секунд, и это очень просто. Вы будете вознаграждены 25 бесплатными дополнительными конвертациями каждый день. Это включает в себя создание аккаунта. (Не волнуйтесь, это бесплатно навсегда).\n\nЯ также поддерживаю автоматические конвертации файлов (даже в групповых чатах)! Включите автоматическое конвертирование, если у вас много файлов одного типа для конвертации. Вы можете включить автоматическое конвертирование сразу после того, как вы конвертировали файл.\n\nВы можете установить язык с помощью /language.\n\nПомните, что этот бот не работал бы без многочисленных участников, которых он сделал - стал одним из них! /contribute\n\nДискуссионная группа: @cloud_convert_bot_lounge\nНовостной канал: @cloud_convert_bot_news", 4 | "helpmsgStartGroups": "Привет!\nЯ - Cloud Convert Bot, я могу помочь тебе конвертировать твой файл! Напиши /help, чтоб узнать больше информации, укажи свой язык с помощью /language - и не забудь указать свой аккаунт с помощью команды /contribute", 5 | "helpmsgGroups": "Привет!\nМеня зовут Cloud Convert Bot и я могу помочь вам с конвертацией файлов!\nЯ не буду спамить вас сообщениями или конвертированными файлами (если вы не попросите вежливо). Есть два способа сказать мне, что я должен конвертировать файл для вас:\n 1) Подтвердить к файлу, который кто-то присылает. Ответьте непосредственно с заданным форматом (например, /mp4) или отправьте /convert, чтобы увидеть возможные форматы. Я буду использовать последний файл, если вы не нажмете ответ для любого сообщения.\n 2) Послать подпись при отправке файла, например, /mp4 для преобразования в MP4.\n\nПосле завершения преобразования можно включить авто-конвертирования. Если вы включите автоматическое конвертацию для файла того или иного типа, я автоматически повторю это конвертирование для всех файлов одного типа.\n\n Самая удивительная функция заключается в том, что вы можете настроить собственную учетную запись. Этот бот может некоторое время работать без учетной записи, но если вы регулярно пользуетесь ботом, то настройка учетной записи действительно важна, поскольку таким образом вы сможете получить более бесплатные преобразования. Настройте его с помощью команды /contribute. Таким образом, вы сможете избежать некоторых /ограничений, а также внести свой вклад в этот бот (что очень полезно).\n\nОбратите внимание, что все команды в этом групповом чате должны заканчиваться на \"@cloud_convert_bot\", иначе я их проигнорирую (например, не /mp4, а /mp4@cloud_convert_bot)!", 6 | "helpmsgLimitations": "В настоящее время существует два ограничения. Первое: вы можете конвертировать только несколько файлов в день. Второе: вы можете конвертировать только файлы определенного размера.\n\nПотому что все пользователи этого бота разделяют общий пул из 25 конвертаций в день, и другие пользователи могут потреблять ваши конвертаций (проверь баланс с помощью /balance), иногда вы не можете конвертировать любой файл на всех. Хорошая вещь заключается в том, что вам просто нужно настроить учетную запись и хоба!- этот лимит снят! Проверьте /contribute для этого!\n\nТелеграмма не позволяет ботам (как мне) скачивать файлы размером более 20 МБ или загружать файлы размером более 50 МБ. Это ограничение не может быть изменено. Если вам необходимо конвертировать файлы большего размера, вы можете посетить cloudconvert.com. Прости!", 7 | "helpmsgSetUpAccount": "Добро пожаловать, будущий помощник бота!\nВнося свой вклад в работу с ботом, вы можете заявить о своих 25 бесплатных дополнительных конвертациях в день! Никто другой не сможет повлиять на этот счетчик. Вам не придется ничего платить за это, и это работает полностью без колдовства. Все, что вам нужно сделать, это следовать этим трем шагам:\n1) Создайте свою собственную учетную запись Cloud Convert здесь.\n2) Посетите панель инструментов и скопируйте ключ API.\n3) Вернитесь к этому чату и отправьте /apikey. Вставьте ключ API в этот чат.\nМолодец! Теперь каждая операция этого бота будет работать на основе вашего нового аккаунта Cloud Convert! Сброс ботов с помощью /reset очищает API ключ от нашей базы данных. После того, как вы прислали мне ваш API ключ, я скажу вам секретную команду бота в качестве благодарности!\n\nПожалуйста, обратите внимание, что ни этот бот, ни его разработка никак не связаны с cloudconvert.com. Люди, стоящие за этим сайтом, просто предлагают бесплатные преобразования файлов, и у них есть отличный способ подключения ботов к этому сервису. Они находятся в Мюнхене, Германия, и вам не нужно беспокоиться о конфиденциальности или рекламы или \"мы скучаем по вам\" фигня, как только вы подписались. Помните, что подключение собственной учетной записи к этому боту очень важно для его функционирования.", 8 | "helpmsgBalanceWithApiKey": "Вау! Ты подключил свой личный ключ аккаунта Cloud Convert для этого бота! Спасибо! Ты можешь проверить его баланс с помощью /balance.\n\nТы помог боту подключив API ключ (спасибо!)", 9 | "validatingApiKey": "Проверка...", 10 | "helpmsgBuyMinutes": "Если вам нужно выполнить еще больше преобразований, вы можете купить минуты преобразований на сайте www.cloudconvert.com. Этот бот будет автоматически использовать их, если они доступны. Однако, пожалуйста, помните, что этот проект был создан одним студентом Кильского университета. Несмотря на то, что я сделал все возможное, чтобы сохранить этот кусок программного обеспечения свободным от ошибок и как можно более надежным, я не могу гарантировать, что этот бот не случайно потребляют все ваши преобразования минут, убивая вашего котенка или тому подобное. До сих пор этого никогда не происходило, и я считаю, что это маловероятно, но это все равно программное обеспечение, так что никогда не знаешь. Если вы знаете TypeScript, вы можете проверить исходный код, чтобы убедиться, что чего-то настолько плохого, как это, никогда не случится.", 11 | "autoConversionSaved": "Сохранено.", 12 | "remainingConversions": "Осталось конвертаций", 13 | "customApiKeyInstruction": "Нужно больше конвертаций? /contribute", 14 | "helpmsgFeedback": "Как этот бот? Расскажите об этом дьяволу @KnorpelSenf или поделитесь своими мыслями в дискуссионной группе по адресу @cloud_convert_bot_lounge!\n\nЛучший способ сказать спасибо - это предоставить ключ API. /подписать\nВы также можете help translate этого бота.", 15 | "sendApiKey": "Прекрасно! Отправь мне API ключ в ответ на это сообщение!", 16 | "helpmsgInfo": "Используй данную команду в ответ на файл! Я скажу тебе все информацию о файле (метаданные), которую я знаю.", 17 | "helpmsgConvert": "Используй эту команду в ответ на файл! Я покажу все возможные варианты конвертации этого файла.", 18 | "helpmsgFile": "Отлично, отправь мне файл, чтобы я его конвертировал в ", 19 | "fileInfo": "Тут информация о твоем файле:", 20 | "noFileInfo": "Я не могу получить информацию о твоем файле, прости!", 21 | "reset": "Я сбросил все твои настройки, в том числе API ключ. Жалко, что ты уходишь! :(\nТы всегда можешь получить свои бесплатные минуты назад, отправив /contribute!", 22 | "cancelOperation": "Отменить операцию", 23 | "operationCancelled": "Операция отменена.", 24 | "helpmsgText": "Я не могу конвертировать текстовые сообщения. Вместо этого пришлите мне файл, чтобы конвертировать его!", 25 | "helpmsgTextKeySuggestion": "Я не могу конвертировать текстовые сообщения. Отправь мне файл для конвертации!\n\nТы пытаешься ввести свой API ключ? Это возможно 2-мя путями. Не важно, что ты выберешь из этого. Ты можешь:\n1) Отправить сообщение такого формата: \"/apikey твой_api_ключ\"\nИли просто:\n2) Сначала отправить \"/apikey\". Я отреагирую на этого, потом через функцию Telegram ответь на это сообщение, где ты введешь свой API ключ.", 26 | "apiKeyProvided": "Спасибо, что указал API ключ! Твой аккаунт настроен. Тебе бот не использует свой аккаунт, ты помог сделать бота полезнее для других пользователей!\n\nЯ пообещал тебе показать секретную команду и я люблю выполнять свои обещания! Держи, когда ты отправил файл, отправь в ответ команду /info, чтоб получить подробную информацию о твоем файле. Будьте осторожны, там много всего довольно технического, но есть и куча крутых фактов, о которых ты, наверное, не знал. Это очень круто! Зацени! ", 27 | "personalApiKeyInUse": "Так как ты уже указал свой API ключ, я буду использовать твой CloudConvert аккаунт в данном чате! Ура! (Если ты не хочешь этого, то ты можешь сбросить настройки бота.)", 28 | "fileTooBig": "Файл слишком большой! Проверь /limitations", 29 | "unknownError": "Что-то пошло не так. Прости. Ты можешь сообщить об этом в @cloud_convert_bot_lounge.", 30 | "invalidApiKey": "Ваш API ключ недействителен! Вы выполнили действия, описанные в разделе /подпись?\n\n1) Убедитесь, что вы проверили вашу учетную запись cloudconvert, перейдя по ссылке в электронном письме, полученном вами после регистрации на www.cloudconvert.com.\n2) Не печатайте API-ключ самостоятельно, т.к. может быть опечатка. Вместо этого скопируйте и вставьте ключ API непосредственно с веб-сайта.\n3) Не используйте логин Facebook на www.cloudconvert.com. Вместо этого используйте электронную почту. Логин Google тоже должен работать.\n4) Если ничего не работает, вы можете заново сгенерировать API на приборной панели и попробовать /contribute еще раз.\n\nПосле того, как вы предоставили действительный ключ, вы всегда можете отказаться и вернуться к использованию учетной записи, совместно используемой всеми пользователями-ботами. Для этого просто сбросьте бот с помощью /reset.\n\nЭто недействительный ключ API, который вы предоставили:\n", 31 | "noMoreConversionMinutes": "Похоже не осталось бесплатных конвертаций! Проверь /balance!\n\nТы получишь автоматически 25 бесплатных конвертаций каждые 24 часа. Если ты не хочешь ждать, то ты можешь конвертировать свой файл прямо сейчас. Тебе просто нужно следовать пунктам в /contribute", 32 | "listFormats": "Заебись! Я могу конвертировать этот файл ${filetype} в:", 33 | "autoConvert": "Авто-конвертация ${from} в ${to}", 34 | "pickLanguage": "Установи свой язык используя кнопку снизу.\n\nРазговариваешь на другом языке? Нашел ошибку? Помоги перевести бота!\nПросто нажми на эту ссылку!", 35 | "languageName": "🇷🇺 русский", 36 | "resultFileTooBig": "Файл слишком большой! Проверь /limitations" 37 | } -------------------------------------------------------------------------------- /src/bot/locales/br.json: -------------------------------------------------------------------------------- 1 | { 2 | "helpmsgStartPrivate": "Olá!\nEu posso te ajudar com conversão de arquivos!\nPor favor me envie seu arquivo para converter. /help", 3 | "helpmsgPrivate": "Olá! Eu sou um bot conversor de arquivos. Suporto 218 formatos de arquivo diferentes e sei como lidar com mídia de qualquer tipo (arquivos de áudio, documentos, GIFs, fotos, adesivos, vídeos, anotações de voz e anotações de vídeo).\n\nIMPORTANTE: Você pode experimentar gratuitamente. Se precisar converter apenas um arquivo, vá em frente e faça isso. No entanto, este bot é um projeto da comunidade. Se você deseja usar este bot com mais frequência, contribua fornecendo uma chave de API: confira as instruções em /contribute. Leva apenas 30 segundos e é muito simples. Você será recompensado com 25 conversões extras gratuitas todos os dias. Envolve a criação de uma conta. (Não se preocupe, é gratuito para sempre.)\n\nTambém sou capaz de realizar conversões automáticas de arquivos (mesmo em chats em grupo)! Habilite as conversões automáticas se você tiver muitos arquivos do mesmo tipo para converter. Você pode ativar as conversões automáticas assim que converter um arquivo.\n\nVocê pode definir o idioma com /language.\n\nLembre-se de que este bot não funcionaria sem os muitos contribuidores que possui - torne-se um deles! /contribute\n\nGrupo de discussão: @cloud_convert_bot_lounge\nCanal de notícias: @cloud_convert_bot_news", 4 | "helpmsgStartGroups": "Olá!\nMeu nome é Cloud Converter Bot e eu posso te ajudar com conversão de arquivos! Escreva /help para um tour rapido, mude seu idioma com /language – e não se esqueça de configurar sua conta: /contribute", 5 | "helpmsgGroups": "Olá!\nMeu nome é Cloud Convert Bot e posso ajudá-lo com as conversões de arquivos!\nNão vou enviar spam para você com nenhuma mensagem ou arquivo convertido (a menos que você peça com educação). Há duas maneiras de me dizer que devo converter um arquivo para você:\n 1) Responder a um arquivo enviado por alguém. Responda diretamente com o formato de destino (por exemplo, /mp4) ou envie /convert para ver os formatos possíveis. Usarei o arquivo mais recente se você não clicar em responder para nenhuma mensagem.\n 2) Envie uma legenda ao enviar o arquivo, ex.: /mp4 para converter para MP4.\n\nAssim que a conversão for concluída, você pode ativar conversões automáticas. Se você habilitar as conversões automáticas para um tipo de arquivo, repetirei automaticamente essa conversão para todos os arquivos do mesmo tipo.\n\nO recurso mais incrível é que você pode configurar sua própria conta. Este bot funciona por algum tempo sem uma conta, mas se você usa o bot regularmente, abrir uma conta é muito importante porque você pode obter muuuuito mais conversões gratuitas. Configure-o com /contribute. Desta forma, você pode evitar algumas /limitations e também contribuir com este bot (o que é muito útil).\n\nObserve que todos os comandos neste chat em grupo precisam terminar em “@cloud_convert_bot”, caso contrário, irei ignorá-los (por exemplo, incorreto -> /mp4, correto -> /mp4@cloud_convert_bot)!", 6 | "helpmsgLimitations": "Atualmente, existem duas limitações. Primeira: você só pode converter alguns arquivos por dia. Segunda: você só pode converter arquivos até um determinado tamanho.\n\nComo todos os usuários deste bot compartilham uma quantidade comum de 25 conversões por dia e outros usuários podem consumir suas conversões (verifique o saldo com /balance), às vezes você pode não conseguir converter nenhum arquivo. O bom é: você precisa simplesmente configurar uma conta e BOOM - esse limite acabou! Veja /contribute para saber como fazer isso!\n\nO Telegram não permite que bots (como eu) baixem arquivos com mais de 20 MB ou carreguem arquivos com mais de 50 MB. Este limite não pode ser alterado. Se você precisar converter arquivos maiores, pode visitar cloudconvert.com.", 7 | "helpmsgSetUpAccount": "Bem-vindo, futuro contribuidor do bot!\nAo contribuir para o bot, você pode reivindicar suas próprias 25 conversões extras gratuitas por dia! Ninguém mais será capaz de impactar este contador. Você não terá que pagar nada por isso e funciona totalmente sem bruxaria. Tudo que você precisa fazer é seguir estas três etapas:\n1) Crie sua própria conta do Cloud Convert aqui.\n2) Visite o painel/dashboard e copie a chave de API V1.\n3) Volte a este chat e envie /apikey. Cole a chave de API neste chat.\nBom trabalho! Agora, cada operação desse bot funcionará com base em sua nova conta do Cloud Convert! Reiniciar o bot com /reset limpa a chave de API de nosso banco de dados. Depois que você me enviar sua chave de API, contarei a você um comando secreto do bot como um presente de agradecimento!\n\nObserve que nem este bot, nem seu desenvolvedor, estão de forma alguma associados ao cloudconvert.com. As pessoas por trás desse site apenas oferecem conversões gratuitas de arquivos e têm uma maneira bacana de conectar bots a esse serviço. Eles estão localizados em Munique, Alemanha, e você não precisa se preocupar com questões de privacidade ou anúncios ou baboseiras de \"sentimos sua falta\" depois de se inscrever. Lembre-se de que conectar sua própria conta a este bot é muito importante para que ele funcione.", 8 | "helpmsgBalanceWithApiKey": "Oba! Você conectou sua conta pessoal do Cloud Convert a este bot! Obrigado! Voce pode checar seu saldo com /balance\n\nVocê conectou este bot fornecendo o seguinte API key (Obrigado!):", 9 | "validatingApiKey": "Validando...", 10 | "helpmsgBuyMinutes": "Se precisar realizar ainda mais conversões, você pode comprar minutos de conversão em www.cloudconvert.com. Este bot irá usá-los automaticamente, se disponíveis. No entanto, lembre-se de que este projeto foi criado por um único aluno da Universidade de Kiel. Embora eu tenha feito o meu melhor para manter este software livre de erros e o mais confiável possível, não posso garantir que este bot não esteja consumindo acidentalmente todos os seus minutos de conversão, matando seu gatinho ou algo parecido. Isso nunca aconteceu até agora e considero altamente improvável que aconteça, mas ainda é um software, então nunca se sabe. Se você conhece TypeScript, pode verificar o código-fonte para verificar e contribuir para que algo ruim assim nunca aconteça.", 11 | "autoConversionSaved": "Salvo.", 12 | "remainingConversions": "Conversões restantes", 13 | "customApiKeyInstruction": "Precisa realizar mais conversões? /contribute", 14 | "helpmsgFeedback": "Está gostando deste bot? Diga ao desenvolvedor @KnorpelSenf ou compartilhe suas ideias no grupo de discussão em @cloud_convert_bot_lounge!\n\nA melhor maneira de agradecer é fornecendo uma chave de API. /contribute\nVocê também pode ajudar a traduzir este bot.", 15 | "sendApiKey": "Perfeito! Agora me envie a chave de API em resposta a esta mensagem!", 16 | "helpmsgInfo": "Use esse comando em resposta a um arquivo! Eu direi a você todas as informações desse arquivo (meta data) que eu souber.", 17 | "helpmsgConvert": "Use esse comando em reposta a um arquivo! Vou listar todas as conversões possíveis para ele.", 18 | "helpmsgFile": "Ok, agora me envie um arquivo para ser convertido.", 19 | "fileInfo": "Informações do arquivo:", 20 | "noFileInfo": "Não foi possível achar nenhuma meta data sobre seu arquivo, desculpe.", 21 | "reset": "Eu reinicio todas as suas configurações, incluindo a chave de API. É triste te ver partir. :(\nVocê sempre pode ter suas conversões de volta em minutos, basta enviar /contribute e seguir as instruções!", 22 | "cancelOperation": "Cancelar operação", 23 | "operationCancelled": "Operação cancelada.", 24 | "helpmsgText": "Eu não posso converter mensagens de texto. Ao invés disso, me envie um arquivo para convertê-lo!", 25 | "helpmsgTextKeySuggestion": "Eu não posso converter mensagens de texto. Ao invés disso, me envie um arquivo para convertê-lo!\n\nVocê está tentando enviar sua chave de API? Isso é possível de duas maneiras. Não importa qual você escolha. Você também pode:\n1) Enviar a mensagem no seguinte formato: “/apikey ABC_SUA_CHAVE_API_XYZ”\nOu você pode também:\n2) Primeiramente enviar apenas “/apikey”. Eu vou responder a isso. Em seguida, use o recurso de resposta do Telegram para responder à minha mensagem quando você, por sua vez, enviar sua chave de API.", 26 | "apiKeyProvided": "Obrigado por fornecer a chave de API! Sua própria conta agora está pronta e configurada. Ao não depender mais da conta padrão, você ajuda a tornar o bot mais útil para todos!\n\nPrometi revelar um comando secreto do bot e cumpro minhas promessas! Vamos lá: sempre que você enviar um arquivo, responda a ele com /info para obter dados detalhados a seu respeito. Esteja avisado que muitas informações são bem técnicas, mas também há vários fatos interessantes que você provavelmente não sabia. Quão incrível é isso?! Confira!", 27 | "personalApiKeyInUse": "Como você já forneceu sua chave de API pessoal, também vou usar sua conta CloudConvert neste chat! Eba! (Se você não quiser isso, pode redefinir o bot neste chat usando o /reset.)", 28 | "fileTooBig": "O arquivo é grande demais! Veja /limitations", 29 | "unknownError": "Algo deu errado. Desculpe por isso. Você pode entrar em contato comigo pelo @cloud_convert_bot_lounge e reportar o ocorrido.", 30 | "invalidApiKey": "Sua chave de API é inválida! Você seguiu as etapas em /contribute?\n\n1) Certifique-se de verificar sua conta CloudConvert clicando no link no e-mail que você recebeu após se registrar em www.cloudconvert.com.\n2) Não digite a chave de API, pois pode haver um erro de digitação. Em vez disso, copie e cole a chave de API diretamente do site.\n3) Não use o login do Facebook em www.cloudconvert.com. Em vez disso, use um e-mail. O login do Google também deve funcionar.\n4) Se nada funcionar, você pode gerar novamente a API no painel/dashboard e tentar /contribute novamente.\n\nDepois de fornecer uma chave válida, você sempre pode cancelar e voltar a usar a conta compartilhada entre todos os usuários do bot. Para fazer isso, basta redefinir o bot com /reset.\n\nEsta é a chave de API inválida que você forneceu:", 31 | "noMoreConversionMinutes": "Parece que não há conversões grátis restantes! Verifique seu /balance!\n\nVocê receberá automaticamente mais 25 conversões gratuitas, que serão compartilhadas com todos os usuários gratuitos que não ainda contribuem, nas próximas 24 horas. Se você não quiser esperar e ter seu limite individual de conversões, pode converter seu arquivo agora mesmo. Você só precisa seguir as etapas em /contribute.", 32 | "listFormats": "Ótimo! Posso converter esse arquivo ${filetype} para:", 33 | "autoConvert": "Sempre converter ${from} para ${to}", 34 | "pickLanguage": "Defina seu idioma usando um dos botões abaixo.\n\nFala outra língua? Encontrou um erro de digitação? Ajude a traduzir este bot! Basta clicar neste link!", 35 | "languageName": "🇧🇷 Português (Brasil)", 36 | "resultFileTooBig": "O arquivo final é grande demais! Veja /limitations" 37 | } -------------------------------------------------------------------------------- /src/bot/locales/id.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiKeyProvided": "Terima kasih telah memberikan kunci API! Akun Anda sendiri sekarang sudah siap dan disiapkan. Dengan tidak lagi mengandalkan akun default, Anda membantu membuat bot lebih berguna untuk semua orang di luar sana!\n\nSaya berjanji untuk mengungkap perintah bot tersembunyi, dan saya suka menepati janji! Ini dia: setiap kali Anda memberikan file, kirim /info untuk mendapatkan informasi rinci tentang file Anda. Hati-hati, banyak hal yang cukup teknis di sana, tetapi ada juga banyak fakta keren yang mungkin tidak Anda ketahui. Betapa hebatnya itu ?! Saksikan berikut ini!", 3 | "autoConversionSaved": "Disimpan", 4 | "autoConvert": "konversi otomatis ${from} menjadi ${to}", 5 | "cancelOperation": "Batalkan operasi", 6 | "customApiKeyInstruction": "Perlu melakukan lebih banyak konversi? /contribute", 7 | "fileInfo": "Berikut info file Anda:", 8 | "fileTooBig": "File terlalu besar! Lihat /limitations", 9 | "helpmsgBalanceWithApiKey": "Yay! Anda telah menghubungkan akun Cloud Convert pribadi Anda dengan bot ini! Terima kasih! Anda bisa mengecek saldo dengan /balance.\n\nAnda menghubungkan bot ini dengan memberikan kunci API berikut (terima kasih!):", 10 | "helpmsgBuyMinutes": "Jika Anda perlu melakukan lebih banyak konversi, Anda dapat membeli menit konversi di www.cloudconvert.com. Bot ini akan secara otomatis menggunakannya jika tersedia. Namun, harap diingat bahwa proyek ini dibuat oleh satu siswa di Universitas Kiel. Meskipun saya melakukan yang terbaik untuk menjaga perangkat lunak ini bebas dari kesalahan dan dapat diandalkan, saya tidak dapat menjamin bahwa bot ini tidak secara tidak sengaja menghabiskan semua menit konversi Anda , membunuh anak kucing Anda atau sejenisnya . Sejauh ini belum pernah terjadi dan saya menganggapnya sangat tidak mungkin, tetapi ini masih perangkat lunak, jadi Anda tidak pernah tahu. Jika Anda tahu TypeScript, Anda dapat memeriksa kode sumber untuk memverifikasi bahwa sesuatu yang seburuk ini tidak akan pernah terjadi.", 11 | "helpmsgConvert": "Gunakan perintah ini untuk membalas file! Saya kemudian akan mendaftar semua kemungkinan konversi untuk itu.", 12 | "helpmsgFeedback": "Suka bot ini? Beri tahu dev @KnorpelSenf atau bagikan pemikiran Anda dalam grup diskusi di @cloud_convert_bot_lounge!\n\nCara terbaik untuk mengucapkan terima kasih adalah dengan memberikan kunci API. /contribute\nAnda juga dapat membantu menerjemahkan bot ini.", 13 | "helpmsgFile": "Baiklah, sekarang kirimi saya file untuk dikonversi ", 14 | "helpmsgGroups": " Hai yang disana! \nNama saya Cloud Convert Bot dan saya dapat membantu Anda dengan konversi file!\nSaya tidak akan mengirimi Anda spam dengan pesan apa pun atau file apa pun yang dikonversi (kecuali Anda memintanya dengan baik). Ada dua cara untuk memberi tahu saya bahwa saya harus mengonversi file untuk Anda:\n 1) Balas ke file yang dikirim seseorang. Balas dengan format target secara langsung (e. G. /mp4) atau kirim /convert untuk melihat format yang memungkinkan. Saya akan menggunakan file terbaru jika Anda tidak menekan reply untuk pesan apa pun.\n 2) Kirim keterangan saat Anda mengirim file, e. g. /mp4 untuk dikonversi ke MP4.\n\nSetelah konversi selesai, Anda dapat mengaktifkan konversi otomatis . Jika Anda mengaktifkan konversi otomatis untuk jenis file, saya secara otomatis akan mengulangi konversi ini untuk semua file dengan jenis yang sama.\n\n Fitur yang paling mengagumkan adalah Anda dapat mengatur akun Anda sendiri. Bot ini dapat bekerja untuk beberapa waktu tanpa akun, tetapi jika Anda menggunakan bot secara teratur, membuat akun sangat penting karena Anda bisa mendapatkan lebih banyak konversi gratis seperti itu. Siapkan dengan /contribute. Dengan cara ini, Anda dapat menghindari beberapa /limitations dan Anda juga berkontribusi pada bot ini (yang sangat membantu).\n\nPerhatikan bahwa semua perintah dalam obrolan grup ini harus diakhiri dengan \"@cloud_convert_bot\", jika tidak, saya akan mengabaikannya (misalnya, bukan /mp4 tapi /mp4@cloud_convert_bot)!", 15 | "helpmsgInfo": "Gunakan perintah ini untuk membalas file! Saya kemudian akan memberi tahu Anda semua informasi file (meta data) yang saya tahu.", 16 | "helpmsgLimitations": "Saat ini ada dua batasan . Pertama: Anda hanya dapat mengonversi beberapa file dalam sehari. Kedua: Anda hanya dapat mengonversi file dengan ukuran tertentu.\n\nKarena semua pengguna bot ini berbagi kumpulan 25 konversi per hari dan pengguna lain dapat menggunakan konversi Anda (periksa saldo dengan /balance), Anda terkadang tidak dapat mengonversi file apa pun sama sekali. Hal yang baik adalah: Anda hanya perlu membuat akun dan BOOM — batas ini hilang! Lihat /contribute untuk itu!\n\nTelegram tidak mengizinkan bot (seperti saya) untuk mengunduh file dengan ukuran lebih dari 20 MB atau mengunggah file dengan ukuran lebih dari 50 MB. Batas ini tidak dapat diubah. Jika Anda perlu mengonversi file yang lebih besar, Anda dapat mengunjungi cloudconvert.com. Maaf!", 17 | "helpmsgPrivate": "Hai! Aku adalah bot konverter file. Aku mendukung 218 format file berbeda dan aku tahu cara menangani segala jenis media ( file audio , dokumen , GIF , foto , stiker , video , catatan suara , dan catatan video ).\n\n PENTING: Kamu bisa mencobanya secara gratis. Jika kamu cuma perlu mengonversi satu file, maka lanjutkan saja. Namun, bot ini adalah proyek komunitas . Jika kamu ingin lebih sering menggunakan bot ini, silakan berkontribusi dengan memberikan kunci API : lihat /contribute . Ini hanya membutuhkan waktu 30 detik dan sangat sederhana. Kamu akan diberi hadiah 25 konversi ekstra gratis setiap hari. Ini melibatkan pengaturan akun. (Jangan khawatir, ini gratis selamanya.)\n\nAku juga mendukung konversi file otomatis (bahkan dalam obrolan grup)! Aktifkan konversi otomatis kalo kamu punya banyak file dengan jenis yang sama untuk dikonversi. Kau bisa mengaktifkan konversi otomatis segera setelah kau mengonversi file.\n\nKamu bisa ngatur bahasa dengan /language.\n\nIngatlah bahwa bot ini tidak akan berfungsi tanpa banyak kontributor yang dimilikinya — jadilah salah satunya! /contribute\n\nGrup diskusi: @cloud_convert_bot_lounge\nSaluran berita: @cloud_convert_bot_news", 18 | "helpmsgSetUpAccount": "Selamat datang, kontributor bot masa depan!\nDengan berkontribusi ke bot, Anda dapat mengklaim 25 konversi ekstra gratis Anda sendiri per hari ! Tidak ada orang lain yang dapat memengaruhi penghitung ini. Anda tidak perlu membayar apa pun untuk ini dan ini berfungsi sepenuhnya tanpa sihir. Yang perlu Anda lakukan adalah mengikuti tiga langkah ini:\n 1) Buat akun Cloud Convert Anda sendiri di sini .\n 2) Kunjungi dasbor dan salin kunci API.\n 3) Kembali ke obrolan ini dan kirim /apikey. Tempel kunci API ke dalam obrolan ini.\nKerja bagus! Sekarang setiap operasi bot ini akan berfungsi berdasarkan akun Cloud Convert baru Anda! Menyetel ulang bot dengan /reset menghapus kunci API dari database kami. Setelah Anda mengirimi saya kunci API Anda, saya akan memberi tahu Anda perintah bot rahasia sebagai hadiah terima kasih!\n\nHarap dicatat bahwa baik bot ini maupun pengembangnya sama sekali tidak terkait dengan cloudconvert.com. Orang-orang di belakang situs itu hanya menawarkan konversi file gratis dan mereka memiliki cara yang rapi untuk menghubungkan bot ke layanan itu. Mereka berbasis di Munich, Jerman dan Anda tidak perlu khawatir tentang masalah privasi atau iklan atau omong kosong \"kami merindukanmu\" setelah Anda mendaftar. Ingatlah bahwa menghubungkan akun Anda sendiri ke bot ini sangat penting agar bot ini berfungsi.", 19 | "helpmsgStartGroups": " Hai yang disana! \nNama saya Cloud Convert Bot dan saya dapat membantu Anda dengan konversi file! Ketik /help untuk tur singkat, setel bahasa Anda dengan /language — dan jangan lupa untuk menyiapkan akun Anda: /contribute", 20 | "helpmsgStartPrivate": "Hai yang disana!\nAku bisa membantumu mengkonversi file!\nKirimkan aku filemu untuk dikonversi. /help", 21 | "helpmsgText": "Saya tidak dapat mengubah pesan teks. Sebagai gantinya, kirimkan saya file untuk mengonversinya!", 22 | "helpmsgTextKeySuggestion": "Saya tidak dapat mengubah pesan teks. Sebagai gantinya, kirimkan saya file untuk mengonversinya!\n\nApakah Anda mencoba mengirimkan kunci API Anda? Ini dimungkinkan dengan dua cara. Tidak masalah yang mana yang Anda pilih. Anda bisa:\n1) Kirim pesan dengan format berikut: “/apikey ABC_YOUR_API_KEY_XYZ”\nAtau Anda juga bisa:\n2) Pertama, kirim saja \"/apikey\". Saya akan menanggapi itu. Kedua, gunakan fitur balasan Telegram untuk membalas pesan saya saat Anda mengirimkan kunci API Anda secara bergiliran.", 23 | "invalidApiKey": "Kunci API Anda tidak valid! Apakah Anda mengikuti langkah-langkah di bawah /contribute?\n\n1) Pastikan Anda memverifikasi akun cloudconvert Anda dengan mengklik link di email yang Anda terima setelah mendaftar di www.cloudconvert.com.\n2) Jangan ketik kunci API sendiri karena mungkin ada kesalahan ketik. Sebagai gantinya, salin dan tempel kunci API dari situs web secara langsung.\n3) Jangan gunakan login Facebook di www.cloudconvert.com. Gunakan email sebagai gantinya. Login Google juga harus berfungsi.\n4) Jika tidak ada yang berhasil, Anda dapat membuat ulang API di dasbor dan mencoba /contribute lagi.\n\nSetelah Anda memberikan kunci yang valid, Anda selalu dapat memilih keluar lagi dan kembali menggunakan akun yang dibagikan di antara semua pengguna bot. Untuk melakukannya, cukup setel ulang bot dengan /reset.\n\nIni adalah kunci API tidak valid yang Anda berikan:\n", 24 | "languageName": "🇮🇩 Indonesia", 25 | "listFormats": "Hebat! Saya dapat mengonversi ${filetype} ini menjadi:", 26 | "noFileInfo": "Saya tidak bisa menemukan meta data apa pun tentang file Anda, maaf!", 27 | "noMoreConversionMinutes": "Sepertinya tidak ada konversi gratis yang tersisa! Cek /balance!\n\nAnda secara otomatis akan diberikan 25 lebih banyak konversi gratis dalam 24 jam ke depan. Jika Anda tidak ingin menunggu, dapat mengkonversi file Anda sekarang juga. Anda hanya perlu mengikuti langkah-langkah di bawah /contribute.", 28 | "operationCancelled": "Operasi dibatalkan.", 29 | "personalApiKeyInUse": "Karena Anda sudah memberikan kunci API pribadi Anda, saya juga akan menggunakan akun CloudConvert Anda dalam obrolan ini! Yay! (Jika Anda tidak menginginkan ini, Anda dapat mengatur ulang bot di obrolan ini.)", 30 | "pickLanguage": "Atur bahasa Anda menggunakan salah satu tombol di bawah ini.\n\nBerbicara bahasa lain? Menemukan kesalahan ketik? Bantu terjemahkan bot ini! Cukup klik tautan ini !", 31 | "remainingConversions": "Konversi yang tersisa", 32 | "reset": "Saya mengatur ulang semua konfigurasi Anda, termasuk kunci API. Sedih melihatmu pergi! :(\nAnda selalu bisa mendapatkan menit konversi gratis Anda kembali dengan mengirim /contribute!", 33 | "resultFileTooBig": "File hasil terlalu besar! Lihat /limitations", 34 | "sendApiKey": "Sempurna! Sekarang kirimkan saya kunci API untuk membalas pesan ini!", 35 | "unknownError": "Ada yang salah. Maaf untuk itu. Anda dapat menulis saya di @cloud_convert_bot_lounge karena ini.", 36 | "validatingApiKey": "Memvalidasi ..." 37 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------