Comparing version 0.4.1 to 0.5.0
@@ -0,1 +1,7 @@ | ||
# v0.5.0 (2022-03-12) | ||
- **BREAKING**: This is the first version of Termivolt to support Revolt v0.5.3+ - it will **not work** with older versions of Revolt. | ||
- Added support for archiving channels (`-archive`), fetching messages (`-fetch`) and removing memebrs from groups (`-rmfromgroup`). | ||
- Various other minor improvements. | ||
# v0.4.1 (2022-03-12) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "termivolt", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "A simple utility to interact with the Revolt API via the command line.", | ||
@@ -13,3 +13,3 @@ "main": "dist/src/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/rexogamer/termivolt.git" | ||
"url": "git+https://github.com/rexovolt/termivolt.git" | ||
}, | ||
@@ -27,8 +27,9 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/rexogamer/termivolt/issues" | ||
"url": "https://github.com/rexovolt/termivolt/issues" | ||
}, | ||
"homepage": "https://github.com/rexogamer/termivolt#readme", | ||
"homepage": "https://github.com/rexovolt/termivolt#readme", | ||
"dependencies": { | ||
"chalk": "^5.0.0", | ||
"revolt.js": "^5.2.7" | ||
"chalk": "^5.0.1", | ||
"revchiver": "^0.5.3", | ||
"revolt.js": "^6.0.2" | ||
}, | ||
@@ -44,6 +45,6 @@ "engines": { | ||
"devDependencies": { | ||
"@types/node": "^17.0.10", | ||
"@types/ws": "^8.2.2", | ||
"@types/node": "^17.0.42", | ||
"@types/ws": "^8.5.3", | ||
"rimraf": "^3.0.2" | ||
} | ||
} |
declare const ban: (userType: string, token: string, server: string, userid: string, apiURL?: string) => Promise<undefined>; | ||
export { ban }; |
@@ -0,0 +0,0 @@ import { styles, login } from "../lib/constants/index.js"; |
export { sendMsg } from "./send.js"; | ||
export { kick } from "./kick.js"; | ||
export { ban } from "./ban.js"; | ||
export { rmFromGroup } from "./rmfromgroup.js"; | ||
export { archive } from "./archive.js"; | ||
export { fetchMsgs } from "./fetch.js"; |
export { sendMsg } from "./send.js"; | ||
export { kick } from "./kick.js"; | ||
export { ban } from "./ban.js"; | ||
export { rmFromGroup } from "./rmfromgroup.js"; | ||
export { archive } from "./archive.js"; | ||
export { fetchMsgs } from "./fetch.js"; |
declare const kick: (userType: string, token: string, server: string, userid: string, apiURL?: string) => Promise<undefined>; | ||
export { kick }; |
@@ -0,0 +0,0 @@ import { styles, login } from "../lib/constants/index.js"; |
declare const sendMsg: (userType: string, token: string, channel: string, content: string, apiURL?: string) => Promise<undefined>; | ||
export { sendMsg }; |
@@ -1,2 +0,2 @@ | ||
import { styles, login } from "../lib/constants/index.js"; | ||
import { styles, login, fetchChannel } from "../lib/constants/index.js"; | ||
const sendMsg = async function (userType, token, channel, content, apiURL = "https://api.revolt.chat/") { | ||
@@ -24,13 +24,3 @@ // if any args are missing, throw errors before doing anything | ||
client.on("ready", async () => { | ||
try { | ||
const chnl = client.channels?.get(channel); | ||
if (chnl === undefined) | ||
throw Error; | ||
} | ||
catch (error) { | ||
console.log(styles.error(`There was an issue getting the channel - is the ID correct?\nThe error was: ${error}`)); | ||
client.logout(); | ||
process.exit(); | ||
} | ||
const channel2 = client.channels?.get(channel); | ||
const channel2 = await fetchChannel(client, channel); | ||
console.log(styles.info("[INFO] The channel has been found.")); | ||
@@ -37,0 +27,0 @@ // send the message |
#! /usr/bin/env node --no-warnings --experimental-specifier-resolution=node --experimental-json-modules | ||
export {}; |
#! /usr/bin/env node --no-warnings --experimental-specifier-resolution=node --experimental-json-modules | ||
import chalk from "chalk"; | ||
import { ban, kick, sendMsg } from "./commands/index.js"; | ||
import { archive, ban, fetchMsgs, kick, rmFromGroup, sendMsg, } from "./commands/index.js"; | ||
import { strings, styles } from "./lib/index.js"; | ||
@@ -24,5 +24,20 @@ import packageinfo from "../package.json" assert { type: "json" }; | ||
break; | ||
case "-rmfromgroup": | ||
if (args.length > 4) | ||
console.log(styles.error("You've specified more than 4 arguments.")); | ||
rmFromGroup(args[0], args[1], args[2], args[3]); | ||
break; | ||
case "-archive": | ||
if (args.length > 4) | ||
console.log(styles.error("You've specified more than 4 arguments.")); | ||
archive(args[0], args[1], args[2], args[3]); | ||
break; | ||
case "-fetch": | ||
if (args.length > 4) | ||
console.log(styles.error("You've specified more than 4 arguments.")); | ||
fetchMsgs(args[0], args[1], args[2], args[3]); | ||
break; | ||
case "-help": | ||
// send help message | ||
console.log(`${styles.title(`Termivolt v${packageinfo.version}`)}\nTermivolt is a simple utility to interact with the Revolt API via the command line.\n\n${styles.header("Commands:\n")}${chalk.bold("-send:")} Sends a message via the specified account.\n${chalk.underline("Example usage:")} termviolt -send <(--user/--bot)> <token> <channel ID> <message content (in quotes)> [custom API URL]\n${chalk.underline("Notes:")} Formatting may be broken in some cases.\n\n${chalk.bold("-kick:")} Kicks a member from the specified server.\n${chalk.underline("Example usage:")} termviolt -kick <(--user/--bot)> <token> <server ID> <user ID> [custom API URL]\n${chalk.underline("Notes:")} This requires the Kick Members permission - if you get a 403 error, this might be why.\n\n${chalk.bold("-ban:")} Bans a member from the specified server.\n${chalk.underline("Example usage:")} termviolt -ban <(--user/--bot)> <token> <server ID> <user ID> [custom API URL]\n${chalk.underline("Notes:")} This requires the Ban Members permission - if you get a 403 error, this might be why.`); | ||
console.log(`${styles.title(`Termivolt v${packageinfo.version}`)}\nTermivolt is a simple utility to interact with the Revolt API via the command line.\n\n${styles.header("Commands:\n")}${chalk.bold("-send:")} Sends a message via the specified account.\n${chalk.underline("Example usage:")} termviolt -send <(--user/--bot)> <token> <channel ID> <message content (in quotes)> [custom API URL]\n${chalk.underline("Notes:")} Formatting may be broken in some cases.\n\n${chalk.bold("-fetch:")} Fetches the specified amount of messages from the specified channel.\n${chalk.underline("Example usage:")} termviolt -fetch <(--user/--bot)> <token> <channel ID> <message count> [custom API URL]\n${chalk.underline("Notes:")} This requires the View Channel permission - if you get a 403 error, this might be why.\nMessages are listed newest-first and will not be formatted.\n\n${chalk.bold("-archive:")} Archives the specified channel.\n${chalk.underline("Example usage:")} termviolt -archive <(--user/--bot)> <token> <channel ID> [custom API URL]\n${chalk.underline("Notes:")} This requires the View Channel permission - if you get a 403 error, this might be why. ${chalk.bold("This may take a while!")}\n\n${chalk.bold("-kick:")} Kicks a member from the specified server.\n${chalk.underline("Example usage:")} termviolt -kick <(--user/--bot)> <token> <server ID> <user ID> [custom API URL]\n${chalk.underline("Notes:")} This requires the Kick Members permission - if you get a 403 error, this might be why.\n\n${chalk.bold("-rmfromgroup:")} Removes a member from the specified group.\n${chalk.underline("Example usage:")} termviolt -rmfromgroup <(--user/--bot)> <token> <server ID> <user ID> [custom API URL]\n${chalk.underline("Notes:")} This requires you to own the group - if you get a 403 error, this might be why.\n\n${chalk.bold("-ban:")} Bans a member from the specified server.\n${chalk.underline("Example usage:")} termviolt -ban <(--user/--bot)> <token> <server ID> <user ID> [custom API URL]\n${chalk.underline("Notes:")} This requires the Ban Members permission - if you get a 403 error, this might be why.`); | ||
break; | ||
@@ -29,0 +44,0 @@ default: |
import { Client } from "revolt.js"; | ||
declare const checkIfBot: (input: string) => boolean | "invalid"; | ||
declare const login: (token: string, apiURL: string, userType: string) => Promise<Client>; | ||
export { checkIfBot, login }; | ||
declare const fetchChannel: (client: Client, channel: string) => Promise<import("revolt.js").Channel>; | ||
export { checkIfBot, fetchChannel, login }; |
@@ -31,2 +31,15 @@ import { Client } from "revolt.js"; | ||
}; | ||
export { checkIfBot, login }; | ||
const fetchChannel = async function (client, channel) { | ||
try { | ||
const chnl = client.channels?.get(channel); | ||
if (chnl === undefined) | ||
throw Error; | ||
return chnl; | ||
} | ||
catch (error) { | ||
console.log(styles.error(`There was an issue getting the channel - is the ID correct?\nThe error was: ${error}`)); | ||
client.logout(); | ||
process.exit(); | ||
} | ||
}; | ||
export { checkIfBot, fetchChannel, login }; |
export { default as styles } from "./styles.js"; | ||
export { default as strings } from "./strings.js"; | ||
export * from "./functions.js"; |
export { default as styles } from "./styles.js"; | ||
export { default as strings } from "./strings.js"; | ||
export * from "./functions.js"; |
@@ -0,0 +0,0 @@ declare const _default: { |
@@ -0,0 +0,0 @@ import { styles } from "./index.js"; |
@@ -0,0 +0,0 @@ declare const _default: { |
@@ -0,0 +0,0 @@ import chalk from "chalk"; |
export * from "./constants/index.js"; |
export * from "./constants/index.js"; |
{ | ||
"name": "termivolt", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "A simple utility to interact with the Revolt API via the command line.", | ||
@@ -13,3 +13,3 @@ "main": "dist/src/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/rexogamer/termivolt.git" | ||
"url": "git+https://github.com/rexovolt/termivolt.git" | ||
}, | ||
@@ -27,8 +27,9 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/rexogamer/termivolt/issues" | ||
"url": "https://github.com/rexovolt/termivolt/issues" | ||
}, | ||
"homepage": "https://github.com/rexogamer/termivolt#readme", | ||
"homepage": "https://github.com/rexovolt/termivolt#readme", | ||
"dependencies": { | ||
"chalk": "^5.0.0", | ||
"revolt.js": "^5.2.7" | ||
"chalk": "^5.0.1", | ||
"revchiver": "^0.5.3", | ||
"revolt.js": "^6.0.2" | ||
}, | ||
@@ -44,6 +45,6 @@ "engines": { | ||
"devDependencies": { | ||
"@types/node": "^17.0.10", | ||
"@types/ws": "^8.2.2", | ||
"@types/node": "^17.0.42", | ||
"@types/ws": "^8.5.3", | ||
"rimraf": "^3.0.2" | ||
} | ||
} | ||
} |
@@ -53,2 +53,14 @@ # Termivolt | ||
### Archiving messages (-archive) | ||
To archive messages with Termivolt, run `termivolt -archive`. Here's the full list of arguments: | ||
`termivolt -archive <(--user/--bot)> <token> <channel id (in quotes)> [custom API URL]` | ||
#### Arguments | ||
In addtion to the required arguments: | ||
- The channel ID should be provided as a string (i.e. in quotes). You can find it in the URL when using Revite (the official Revolt client) or by right-clicking the channel's entry on the channel list and selecting "Copy channel ID". | ||
### Kicking users (-kick) | ||
@@ -80,2 +92,15 @@ | ||
### Removing users from a group DM (-rmfromgroup) | ||
To remove users from a group DM with Termivolt, run `termivolt -rmfromgroup`. Note that you need to own the group - if you get a 403 error, this might be why. Here's the full list of arguments: | ||
`termivolt -rmfromgroup <(--user/--bot)> <token> <group id (in quotes)> <user id (in quotes)> [custom API URL]` | ||
#### Arguments | ||
In addtion to the required arguments: | ||
- The group ID should be provided as a string (i.e. in quotes). You can find it in the URL when using Revite (the official Revolt client) or by right-clicking the groups's entry on the DM list and selecting "Copy server ID". | ||
- The user ID should aslo be provided as a string. | ||
### Help (-help) | ||
@@ -87,2 +112,2 @@ | ||
If you want to report a bug, suggest a feature or get help with using Termivolt, you can [open an issue](https://github.com/rexogamer/termivolt/issues/new) or join [Termivolt's support server](https://rvlt.gg/ra9dr2Rd) on Revolt. | ||
If you want to report a bug, suggest a feature or get help with using Termivolt, you can [open an issue](https://github.com/rexovolt/termivolt/issues/new) or join [Termivolt's support server](https://rvlt.gg/ra9dr2Rd) on Revolt. |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
35529
31
508
111
3
1
+ Addedrevchiver@^0.5.3
+ Added@fastify/busboy@2.1.1(transitive)
+ Added@insertish/exponential-backoff@3.1.0-patch.2(transitive)
+ Added@insertish/oapi@0.1.150.1.18(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedaxios@0.26.1(transitive)
+ Addedglobalyzer@0.1.0(transitive)
+ Addedglobrex@0.1.2(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedlong@5.3.0(transitive)
+ Addedmime@3.0.0(transitive)
+ Addedopenapi-typescript@5.4.2(transitive)
+ Addedprettier@2.8.8(transitive)
+ Addedrevchiver@0.5.4(transitive)
+ Addedrevolt-api@0.5.30.5.7(transitive)
+ Addedrevolt.js@6.0.06.0.20(transitive)
+ Addedtiny-glob@0.2.9(transitive)
+ Addedtypescript@4.9.5(transitive)
+ Addedundici@5.28.5(transitive)
+ Addedyargs-parser@21.1.1(transitive)
- Removed@insertish/exponential-backoff@3.1.0-patch.0(transitive)
- Removedrevolt-api@0.5.3-alpha.12(transitive)
- Removedrevolt.js@5.2.8(transitive)
Updatedchalk@^5.0.1
Updatedrevolt.js@^6.0.2