feat(apps): remove reddit bot

The Reddit bot does not work and should be removed until a new library that works for Reddit bots is found.
This commit is contained in:
GramingFoxTeam
2023-09-04 15:53:43 +03:00
parent 29ba476d7b
commit 749b036464
6 changed files with 0 additions and 1238 deletions

View File

@@ -1,16 +0,0 @@
{
"server": {
"port": 3000,
"host": "192.168.1.6"
},
"responses": [
{
"label": "revanced_download",
"threshold": 0.85,
"reply": {
"title": "How to download ReVanced?",
"desc": "You don't."
}
}
]
}

View File

@@ -1,94 +0,0 @@
{
"server": {
"port": 3000,
"host": "127.0.0.1"
},
"responses": [
{
"label": "revanced_crash",
"threshold": 0.85,
"reply": {
"title": "Why is my patched app crashing?",
"description": "It seems like your patched application is crashing, these might be the reason why:\n * You patched a non-suggested version.\n * Patches failed to apply.\n * Non-default patches were used.\n * Split APK was used.",
"color": 14908858
}
},
{
"label": "rvmanager_abort",
"threshold": 0.85,
"reply": {
"title": "Why is ReVanced Manager aborting?",
"description": "It seems like your Manager is aborting. If you see the text \"exit code = 135\" or \"exit code = 139\", then your device's architecture is not supported. Please patch on another device or on your PC.",
"color": 14908858
}
},
{
"label": "revanced_download",
"threshold": 0.85,
"reply": {
"title": "How to download ReVanced?",
"description": "ReVanced is a patcher. You can use the [ReVanced Manager](https://github.com/revanced/revanced-manager/releases/latest) or the [ReVanced CLI](https://github.com/revanced/revanced-cli) to patch the app you want to modify.\n* [ReVanced Manager docs](https://github.com/revanced/revanced-manager/tree/main/docs#-revanced-manager)\n* [ReVanced CLI docs](https://github.com/revanced/revanced-cli/tree/main/docs#-documentation-and-guides-of-revanced-cli)",
"color": 14908858
}
},
{
"label": "androidtv_support",
"threshold": 0.85,
"reply": {
"title": "Will YT ReVanced support Android TVs?",
"description": "YouTube ReVanced for Android/Google TVs won't be made. There are alternatives, such as [SmartTubeNext](https://github.com/yuliskov/SmartTubeNext#smarttube).",
"color": 14908858
}
},
{
"label": "revanced_nodownloader",
"threshold": 0.85,
"reply": {
"title": "Why can't I download videos?",
"description": "You need to install a downloader to download videos. NewPipe is the default downloader, and it can be downloaded from [here](https://github.com/TeamNewPipe/NewPipe/releases/latest).",
"color": 14908858
}
},
{
"label": "revanced_casting",
"threshold": 0.85,
"reply": {
"title": "Why can't I cast?",
"description": "Because of devices like Chromecast, Android/Google TVs using the Cast v2 API, casting to those devices won't work.",
"color": 14908858
}
},
{
"label": "microg_download",
"threshold": 0.85,
"reply": {
"title": "From where can I download Vanced MicroG?",
"description": "You can download Vanced MicroG from [here](https://github.com/TeamVanced/VancedMicroG/releases/latest).",
"color": 14908858
}
},
{
"label": "microg_nointernet",
"threshold": 0.85,
"reply": {
"title": "Why does YT ReVanced say I'm offline?",
"description": "If your YT ReVanced appears to not have internet and you recently changed your Google password, remove the Vanced MicroG account from within your device settings and then log back in.",
"color": 14908858
}
},
{
"label": "rvdownload_unofficial",
"threshold": 0.85,
"reply": {
"title": "What are the official ReVanced sites?",
"description": "The official sites for ReVanced are [revanced.app](https://revanced.app) and [github.com/revanced](https://github.com/revanced).",
"color": 14908858
}
},
{
"label": "false",
"threshold": 0,
"reply": null
}
]
}

View File

@@ -1,34 +0,0 @@
export default {
name: 'aiResponse',
once: false,
async execute(client, config, aiRes) {
if (!aiRes.response) return;
if (!aiRes.response[0]) return;
const ids = aiRes.id.split('/');
const intent = aiRes.response.reduce((a, b) =>
a.confidence > b.confidence ? a : b
);
const response = config.responses.find((res) => res.label === intent.name);
if (response.threshold > intent.confidence) return;
if (!response.reply) return;
const replyString = `## ${response.reply.title}\n\n${response.reply.desc}\n\n*Confidence: ${intent.confidence}*`;
switch (ids[0]) {
case 'comment': {
client
.getComment(ids[1])
.reply(replyString);
break;
}
case 'post': {
client
.getSubmission(ids[1])
.reply(replyString);
break;
}
}
return;
}
};

View File

@@ -1,77 +0,0 @@
import Snoowrap from 'snoowrap';
import { SubmissionStream, CommentStream } from 'snoostorm';
import { readFileSync, readdirSync } from 'node:fs';
// Fix __dirname not being defined in ES modules. (https://stackoverflow.com/a/64383997)
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
import HelperClient from '@revanced-helper/helper-client';
import config from './config.json' assert { type: 'json' };
const helper = new HelperClient(config);
helper.connect();
const client = new Snoowrap({
username: process.env.REDDIT_USERNAME,
password: process.env.REDDIT_PASSWORD,
userAgent: process.env.REDDIT_USER || 'RevancedHelper-Reddit',
clientId: process.env.REDDIT_CLIENT_ID,
clientSecret: process.env.REDDIT_CLIENT_SECRET
});
const checkedItems = [];
const args = {
subreddit: process.env.REDDIT_SUBREDDIT || 'revancedapp',
limit: 10,
pollTime: 5_000
};
const comments = new CommentStream(client, args);
const posts = new SubmissionStream(client, args);
comments.on('item', async (item) => {
await handleItem(item, false);
});
posts.on('item', async (item) => {
await handleItem(item, true);
});
async function handleItem(item, isPost) {
// The "skill issue (refresh)" incident.
if (item.author.name === process.env.REDDIT_USERNAME) return;
if (checkedItems.includes(item.id)) return;
checkedItems.push(item.id);
if (isPost) {
// It's a post, we have to also send the posts body.
helper.scanText(item.title.toLowerCase(), `post/${item.id}`);
helper.scanText(item.selftext.toLowerCase(), `post/${item.id}`);
} else {
helper.scanText(item.body.toLowerCase(), `comment/${item.id}`);
}
}
// The ReVanced Helper events.
const helperEventsPath = join(__dirname, 'helperEvents');
const helperEventFiles = readdirSync(helperEventsPath).filter((file) =>
file.endsWith('.js')
);
for (const file of helperEventFiles) {
const filePath = join(helperEventsPath, file);
const event = (await import(`file://${filePath}`)).default;
if (event.once) {
helper.once(event.name, (...args) =>
event.execute(client, config, ...args)
);
} else {
helper.on(event.name, (...args) =>
event.execute(client, config, ...args)
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
{
"name": "bot-reddit",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Reis Can",
"license": "GPL-3.0-or-later",
"dependencies": {
"@revanced-helper/helper-client": "file:../../../packages/client",
"snoostorm": "^1.5.2"
}
}