Merge branch 'citra-emu:master' into PR-BS-resolver-9001

This commit is contained in:
Efadd 2023-08-23 11:00:55 -05:00 committed by GitHub
commit d6ce2f83ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 621 additions and 571 deletions

View file

@ -33,6 +33,7 @@
"description": "The unique ID for the role that the bot will *remove* when the user accepts the rules."
},
"DISCORD_DEVELOPER_ROLE": true,
"DISCORD_TESTER_ROLE": true,
"DISCORD_LOGIN_TOKEN": {
"description": "The login token of the bot."
},

View file

@ -12,35 +12,34 @@
},
"dependencies": {
"checkenv": "^1.2.2",
"discord.js": "^14.7.1",
"discord.js": "^14.11.0",
"ip": "^1.1.8",
"logdna": "^3.5.3",
"logdna-winston": "^4.0.1",
"node-fetch": "^3",
"string-similarity": "^4.0.4",
"typescript": "^4.9.4",
"winston": "^3.8.2"
"typescript": "^5.1.3",
"winston": "^3.9.0"
},
"devDependencies": {
"@tsconfig/node18": "^1.0.1",
"@tsconfig/node18": "^2.0.1",
"@types/ip": "^1.1.0",
"@types/node": "^18.11.18",
"@types/node-fetch": "^2",
"@types/node": "^20.3.2",
"@types/string-similarity": "^4.0.0",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"esbuild": "^0.17.5",
"eslint": "^8.32.0",
"eslint-config-standard": "^17.0.0",
"@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"esbuild": "^0.18.10",
"eslint": "^8.43.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-promise": "^6.1.1",
"ts-node": "^10.9.1"
},
"scripts": {
"postinstall": "node generateExports.js",
"build": "yarn run esbuild --bundle src/server.ts --platform=node --target=node18 --outdir=dist/",
"build": "yarn run esbuild --bundle src/server.ts --platform=node --target=node18 --outdir=dist/ --minify-whitespace",
"check": "yarn run tsc --noEmit",
"bundle": "./bundle.sh",
"serve": "yarn run ts-node ./src/server.ts"

View file

@ -3,7 +3,5 @@ import * as discord from 'discord.js';
export const roles = ['Admins', 'Moderators', 'CitraBot'];
export async function command (message: discord.Message) {
return Promise.all(message.mentions.users.map(async (user) => {
await ban(user, message.author, message.guild);
}));
return Promise.all(message.mentions.users.map(async (user) => ban(user, message.author, message.guild)));
}

View file

@ -21,8 +21,8 @@ const compatStrings: ICompatList = {
99: { key: '99', name: 'Not Tested', color: 'DarkButNotBlack', description: 'The game has not yet been tested.' }
};
async function updateDatabase() {
let body: any;
async function updateDatabase () {
let body: IGameDBEntry[];
if (!targetServer) {
logger.error('Unable to download latest games list!');
return;
@ -30,7 +30,7 @@ async function updateDatabase() {
try {
const response = await fetch(targetServer);
body = await response.json();
body = (await response.json()) as IGameDBEntry[];
} catch (e) {
logger.error('Unable to download latest games list!');
throw e;
@ -50,7 +50,7 @@ async function updateDatabase() {
state.gameDBPromise = null;
}
export async function command(message: discord.Message) {
export async function command (message: discord.Message) {
if (Date.now() - state.lastGameDBUpdate > refreshTime) {
// Update remote list of games locally.
const waitMessage = message.channel.send('This will take a second...');

View file

@ -1,6 +1,6 @@
import state from '../state';
import logger from '../logging';
import * as discord from 'discord.js';
import { grantRole } from '../common';
export const roles = ['Admins', 'Moderators', 'CitraBot'];
export async function command (message: discord.Message) {
@ -12,26 +12,9 @@ export async function command (message: discord.Message) {
}
return Promise.all(message.mentions.users.map(async (user) => {
return message.guild?.members.fetch(user).then((member) => {
const alreadyJoined = member.roles.cache.has(role);
if (alreadyJoined) {
member.roles.remove(role).then(async () => {
await message.channel.send(`${user.toString()}'s speech has been revoked in the #development channel.`);
}).catch(async () => {
await state.logChannel?.send(`Error revoking ${user.toString()}'s developer speech...`);
logger.error(`Error revoking ${user.toString()} ${user.username}'s developer speech...`);
});
} else {
member.roles.add(role).then(async () => {
await message.channel.send(`${user.toString()} has been granted speech in the #development channel.`);
}).catch(async () => {
await state.logChannel?.send(`Error granting ${user.toString()}'s developer speech...`);
logger.error(`Error granting ${user.toString()} ${user.username}'s developer speech...`);
});
}
}).catch(async () => {
await message.channel.send(`User ${user.toString()} was not found in the channel.`);
});
return message.guild?.members.fetch(user).then((member) => grantRole(member, role, message.channel))
.catch(async () => {
await message.channel.send(`User ${user.toString()} was not found in the channel.`);
});
}));
}

View file

@ -0,0 +1,20 @@
import logger from '../logging';
import * as discord from 'discord.js';
import { grantRole } from '../common';
const role = process.env.DISCORD_TESTER_ROLE;
export const roles = ['Admins', 'Moderators', 'CitraBot'];
export async function command (message: discord.Message) {
if (!role) {
logger.error('DISCORD_TESTER_ROLE suddenly became undefined?!');
return Promise.resolve([]);
}
return Promise.all(message.mentions.users.map(async (user) => {
return message.guild?.members.fetch(user).then((member) => grantRole(member, role, message.channel))
.catch(async () => {
await message.channel.send(`User ${user.toString()} was not found in the channel.`);
});
}));
}

View file

@ -6,7 +6,7 @@ export async function command (message: discord.Message, reply: string | undefin
if (reply == null) {
replyMessage = message.content.substring(message.content.indexOf(' ') + 1);
} else {
replyMessage = `${message.mentions.users.map(user => `${user.toString()}`).join(' ')} ${reply}`;
replyMessage = `${message.mentions.users.map(user => user.toString()).join(' ')} ${reply}`;
}
await message.channel.send(replyMessage);

View file

@ -7,17 +7,17 @@ const fetchOptions = {
const repo = process.env.GITHUB_REPOSITORY || 'citra-emu/citra';
export const roles = ['Admins', 'Moderators', 'Developer'];
export async function command(message: discord.Message) {
export async function command (message: discord.Message) {
const prNumber = message.content.substring(message.content.indexOf(' ') + 1).replace(/\n/g, '');
const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
return fetch(url, fetchOptions).then(response => response.json()).then((pr: any) => {
return fetch(url, fetchOptions).then(response => response.json()).then(async (pr: any) => {
if (!pr || pr.documentation_url || !pr.head) throw new Error('PR not found');
const headSHA = pr.head.sha;
// use the new GitHub checks API
fetch(`https://api.github.com/repos/${repo}/commits/${headSHA}/check-runs`, fetchOptions).then(response => response.json()).then(async (statuses: any) => {
return fetch(`https://api.github.com/repos/${repo}/commits/${headSHA}/check-runs`, fetchOptions).then(response => response.json()).then(async (statuses: any) => {
if (!statuses.check_runs || statuses.total_count < 1) throw new Error('No check runs');
const msg = new discord.EmbedBuilder().setTitle(`Status for PR #${prNumber}`).setURL(pr.html_url);
let color = 'GREEN' as discord.ColorResolvable;
let color: discord.ColorResolvable = 'Green';
statuses.check_runs.forEach((run: any) => {
msg.addFields({ name: run.name, value: `**[${run.status} ${run.conclusion}](${run.html_url})**` });
if (run.conclusion !== 'success') color = 'Red';

View file

@ -5,7 +5,7 @@ import UserWarning from '../models/UserWarning';
import * as discord from 'discord.js';
export const roles = ['Admins', 'Moderators'];
export async function command(message: discord.Message) {
export async function command (message: discord.Message) {
const silent = message.content.includes('silent');
return Promise.all(message.mentions.users.map(async (user) => {

View file

@ -1,7 +1,7 @@
import state from '../state';
import * as discord from 'discord.js';
export async function command(message: discord.Message) {
export async function command (message: discord.Message) {
return Promise.all(message.mentions.users.map(async (user) => {
const warnings = state.warnings.filter(x => x.id === user.id && !x.cleared);
await message.channel.send(`${user.toString()}, you have ${warnings.length} total warnings.`);

View file

@ -18,3 +18,26 @@ export async function ban (user: discord.User, moderator: discord.User, guild: d
data.flushBans();
}
export async function grantRole (member: discord.GuildMember, role: string, channel: discord.TextBasedChannel) {
const user = member.user;
const roleDisplayName = member.guild.roles.cache.get(role)?.name;
const alreadyJoined = member.roles.cache.has(role);
if (alreadyJoined) {
member.roles.remove(role).then(async () => {
await channel.send(`${user.toString()}'s ${roleDisplayName} role has been revoked.`);
}).catch(async () => {
await state.logChannel?.send(`Error revoking ${user.toString()}'s ${roleDisplayName} permission...`);
logger.error(`Error revoking ${user.toString()} ${user.username}'s ${roleDisplayName} permission...`);
});
return;
}
member.roles.add(role).then(async () => {
await channel.send(`${user.toString()} has been granted ${roleDisplayName} role.`);
}).catch(async () => {
await state.logChannel?.send(`Error granting ${user.toString()}'s ${roleDisplayName} permission...`);
logger.error(`Error granting ${user.toString()} ${user.username}'s ${roleDisplayName} permission...`);
});
}

View file

@ -10,22 +10,23 @@
"compat": { "reply": "Click here to view our game compatibility list: <https://citra-emu.org/game/>. ***A Reminder***: Compatibility ratings are user submitted data and may not accurately reflect the game's playability. Your experience may or may not be the same due to differences in hardware or software environments."},
"updates": { "reply": "You can check our latest updates on *Github*. <https://github.com/citra-emu/citra/pulse>"},
"download": { "reply": "Please only download from the official *Citra* website, as downloading from other sources is not supported here. <https://citra-emu.org/download/>"},
"legal": { "reply": "*Citra* is legal, we don't support illegal activities. Dumping your purchased games and system files from your 3DS is legal. Downloading them is not."},
"legal": { "reply": "*Citra* is legal, we don't support illegal activities. Dumping your purchased games from your 3DS is legal. Downloading them is not."},
"building": { "reply": "Please refer to our __building guides__.\nWindows: <https://citra-emu.org/wiki/building-for-windows> \nmacOS: <https://citra-emu.org/wiki/building-for-macos> \nLinux: <https://citra-emu.org/wiki/building-for-linux>"},
"log": { "reply": "For assistance with your issue, please accurately describe the problem and post a log file. The following guide shows how to __get the log file__: <https://community.citra-emu.org/t/how-to-upload-the-log-file/296>"},
"log": { "reply": "For assistance with your issue, please post a log file. The following guide shows how to __get the log file__: <https://community.citra-emu.org/t/how-to-upload-the-log-file/296>"},
"canary": { "reply": "The Nightly build of Citra contains already reviewed and tested features. If you require support with the installation or use of Citra, or you want to report bugs you should use this version.\n\nThe Canary build of Citra is the same as our Nightly builds, with additional features that are still waiting on review before making it into the official Citra builds. We will not provide support for issues found only in this version. If you believe youve found a bug, please retest on our Nightly builds. Both versions are still in development, so expect crashes and bugs."},
"cheats": { "reply": "Looking to add cheats to Citra? Launch your game, head to `Emulation > Cheats` then choose **Add Cheat**. Enter the name of your cheat code and the cheat code itself in the provided boxes. \nOnce the cheat code has been entered correctly, click **Save**. To enable the cheat code, tick the box next to the name of the cheat code in the `Available Cheats` list.\n\nCheats are stored in the gateway format. A sample collection of cheats are located at <https://github.com/iSharingan/CTRPF-AR-CHEAT-CODES/tree/master/Cheats> "},
"cheats": { "reply": "Looking to add cheats? Here's how:\n\n**Desktop**\nThere are two ways to access the Cheats menu:\n1. Right click on your game in Citra's game list, then select `Properties`, and select the `Cheats` tab. \n2. After launching your game, go to `Emulation > Configure Current Game > Cheats tab`\n\nSelect **Add Cheat**, enter the name of your cheat code and the cheat code itself into the relevant boxes, and select **Save**. To enable the cheat code, tick the box next to the name of the cheat code in the `Available Cheats` list.\n\n**Android**\nLaunch your game, then press the Back button to open Citra's in-game menu, and select the `Open Cheats` option. Select the `+` button on the bottom right, then enter the name of your cheat code and the cheat code itself into the relevant boxes. Press Ok, and then press the arrow button on the top left to return to the Cheats menu. Activate the Cheat code.\n\n Cheats are stored in the gateway format. A sample collection of cheats are located at <https://github.com/iSharingan/CTRPF-AR-CHEAT-CODES/tree/master/Cheats>"},
"keys": { "reply": "Users need to provide encryption keys to use encrypted ROMs on Citra. Please follow the __AES Keys guide__ to provide the keys needed. <https://citra-emu.org/wiki/aes-keys/>"},
"mod": {"reply": "To mod your 3DS, please follow the __3DS hacking guide__: <https://3ds.hacks.guide/> \nYou will need a way to read an SD card on your device, such as a built in reader or an adapter."},
"hack": {"reply": "To mod your 3DS, please follow the __3DS hacking guide__: <https://3ds.hacks.guide/> \nYou will need a way to read an SD card on your device, such as a built in reader or an adapter."},
"multiplayer": {"reply": "Please refer to our __multiplayer setup guide__: <https://citra-emu.org/help/feature/multiplayer>"},
"modding": {"reply": "Please refer to our __game modding guide__: <https://citra-emu.org/help/feature/game-modding>"},
"portable": {"reply": "Go to <https://citra-emu.org/download/> and select `Manual download`. Then under **Nightly Build**, click on your operating system's icon to the right of the latest build available to download the build.\nExtract it (.7z can be extracted using Winrar or 7zip) and put it wherever you wish. Inside the extracted `nightly-mingw` folder, create a folder called `user`. This Citra should now store all of its config, save files and such inside of this `user` folder.\nCheck to make sure that this `user` folder is in the same folder that contains `citra-qt(.exe)`\nNow run the `citra-qt` executable found inside of the `mingw` folder."},
"ios": {"reply": "Citra does not have an iOS version because iOS is a \"funky\" operating system to develop for. Therefore, any related videos are scams, and any links are most likely viruses."},
"macos": {"reply": "macOS support has been temporarily dropped whilst work on the graphics backend is underway. Please download the last working build for macOS:\n\nDownload `citra-osx-20220901-d380980.tar.gz` from <https://github.com/citra-emu/citra-nightly/releases/download/nightly-1782/citra-osx-20220901-d380980.tar.gz>\nExtract the `.tar.gz` file then run `citra-qt`."},
"piracy": {"reply": "*Citra* is legal, we don't support illegal activities. Dumping your purchased games and system files from your 3DS is legal. Downloading them is not.\n\nRefer to our __game dumping guides__. \nFor Cartridges: <https://citra-emu.org/wiki/dumping-game-cartridges/> \nFor Installed Titles: <https://citra-emu.org/wiki/dumping-installed-titles/> \nTo dump DLC and Updates, use this guide <https://citra-emu.org/wiki/dumping-updates-and-dlcs/> and install the results through `File -> Install CIA...`\n\nAlso, please refresh yourself on the <#417321837916192779> you agreed to when you joined this server."},
"ios": {"reply": "Citra does not have an official iOS version because iOS is a complicated operating system to develop for. We currently do not have any developers with an interest in developing for this platform. There are some iOS forks of Citra, however they are not supported by us."},
"piracy": {"reply": "*Citra* is legal, we don't support illegal activities. Dumping your purchased games from your 3DS is legal. Downloading them is not.\n\nRefer to our __game dumping guides__. \nFor Cartridges: <https://citra-emu.org/wiki/dumping-game-cartridges/> \nFor Installed Titles: <https://citra-emu.org/wiki/dumping-installed-titles/> \nTo dump DLC and Updates, use this guide <https://citra-emu.org/wiki/dumping-updates-and-dlcs/> and install the results through `File -> Install CIA...`\n\nAlso, please refresh yourself on the <#417321837916192779> you agreed to when you joined this server."},
"saves": {"reply": "Download Checkpoint and open it on the 3DS. Select the game you want, click L. If you require extdata too, not all games do, press X then press L.\n\nThese will be dumped to /3ds/Checkpoint/saves then either saves or extdata.\n\nLaunch Citra and make sure your game directory is listed on the main screen so the game shows up there. Right click on the game you want then choose Open Save Data Location or Open Extra Data Location. Make sure to launch the game at least once in Citra to create these folders first. \n\nOnce those have been open, just replace any save files in Citra with the ones dumped from your 3DS.\n<https://github.com/FlagBrew/Checkpoint>\nTo reverse this and put a Citra save on the 3DS, work backwards and use R to restore it."},
"states": {"reply": "Citra has two kinds of saves available to users, in-game saves and save states.\n\nIn-game saves are the ones you know from the 3DS. These can be shared between devices and are recommended for general use, as they do not corrupt as easily.\nSave states, on the other hand, save Citra's entire emulation state. This includes Citra's configuration, a game's RNG seed, as well as any faults in the emulation at the time of saving. This makes them very useful as a tool for practicing in-game tricks, or for usage in shiny hunting and other RNG related trigger events. However they're not suitable as replacements for in-game save files as the faults in the emulation state would keep building up until the emulation state is too unstable to load properly. They're also ***non-transferable*** because they are made with one setup and only one."},
"folder": {"reply": "When you open the game directory selector, you need to choose the folder your games are in, not the games themselves. Those will auto-populate. The only exception to this are .cia ROM files, which you'll need to install using `File>Install CIA...`"},
"eshop": {"reply": "We're aware that the e-shop has closed. However, whether a game is available for purchase has no bearing on the legality of downloading that game. The games are still copyrighted, thus downloading them off of the internet is still piracy."},
"legacy": {"reply": "Please refer to our __legacy builds guide__ to download any older builds of Citra you may need: <https://citra-emu.org/wiki/citra-legacy-builds/>"},
"lenny": { "reply": "( ͡° ͜ʖ ͡°)"},
"( ͡° ͜ʖ ͡°)": { "reply": "lenny"},
"r1": { "reply": ":beginner: **Rule #1:** \nStay courteous and respectful to others."},
@ -39,4 +40,3 @@
"r9": { "reply": ":beginner: **Rule #9:** \nIn case of no written rule — the discretion of moderators shall take precedence."}
}
}

View file

@ -4,7 +4,7 @@
"help": { "reply": "Need help? Refer to our **asking for help** guide. <https://yuzu-emu.org/help/reference/asking/>" },
"ea": { "reply": "In order to use **yuzu Early Access**, you must have an active forum account with your Patreon account linked to it. Please refer to the following guide to receive prioritized support: <https://yuzu-emu.org/help/early-access/>" },
"faq": { "reply": "For information on your issue, please refer to our **Frequently Asked Questions**. <https://yuzu-emu.org/wiki/faq/>" },
"cpu": { "reply": "For information on Hardware Requirements for yuzu, please refer to this page: <https://yuzu-emu.org/help/quickstart/#hardware-requirements>"},
"hardware": { "reply": "For information on Hardware Requirements for yuzu, please refer to this page: <https://yuzu-emu.org/help/quickstart/#hardware-requirements>"},
"roms": { "reply": "Please read our __community rules__. Warez/downloading games talk is strictly prohibited. To prevent legal issues, you are not allowed to post links or refer to any kind of ROM, NAND, ISO, game, or other copyrighted material that has been illegally obtained or shared. <https://yuzu-emu.org/rules/>"},
"dump-cart": { "reply": "Please refer to our __cartridge dumping guide__. <https://yuzu-emu.org/help/quickstart/#dumping-cartridge-games>"},
"alpha": { "reply": "*yuzu* is currently in very early stages of development. Some games usually run less than full-speed even on the best computers. Expect bugs and glitches to appear in most games. Many features found in more mature emulators are still in the works. For any major updates, please visit <https://yuzu-emu.org/> or the #announcements channel."},
@ -16,7 +16,7 @@
"lenny": { "reply": "( ͡° ͜ʖ ͡°)"},
"( ͡° ͜ʖ ͡°)": { "reply": "lenny"},
"format": { "reply": "A full description of game formats the yuzu supports and when to use them can be found on our wiki. <https://yuzu-emu.org/wiki/overview-of-switch-game-formats/>"},
"keys": { "reply": "Most games require encryption keys to boot. You can dump them from your Switch by following this guide. <https://yuzu-emu.org/help/quickstart/#dumping-prodkeys-and-titlekeys>"},
"keys": { "reply": "Most games require encryption keys to boot. You can dump them from your Switch by following this guide. <https://yuzu-emu.org/help/quickstart/#dumping-decryption-keys>"},
"game-updates": { "reply": "Installing and using game updates are a separate process from the base game. Check out our updates tutorial on our wiki. <https://yuzu-emu.org/wiki/how-to-install-and-use-game-updates/>"},
"appdata": { "reply": "Please refer to the following guide to fully reinstall yuzu: <https://yuzu-emu.org/wiki/faq/#yuzu-will-not-update-further-or-starts-with-a-qt-platform-error>"},
"log": { "reply": "For assistance with your issue, please accurately describe the problem and post a log file. The following guide shows how to __get the log file__: <https://yuzu-emu.org/help/reference/log-files/>"},
@ -40,11 +40,12 @@
"mods": { "reply": "For a list of useful mods for your favorite games, check our database for downloads here: <https://github.com/yuzu-emu/yuzu/wiki/Switch-Mods>"},
"vc": { "reply": "yuzu requires the latest versions of Microsoft Visual C++. Please download and install the following dependency: <https://aka.ms/vs/17/release/vc_redist.x64.exe>"},
"infringe": { "reply": "We are aware of the emulator, and are pursuing legal action. They violate our license, and also ship with copyrighted Nintendo files. As such, any references or discussion of the emulator aren't allowed."},
"android": { "reply": "While we would love to see yuzu ported to Android in the future, we are currently focused on improving the emulator as a whole. Look out for any future announcements, as we'll make sure to let everyone know if an Android build is on the horizon."},
"firmware": { "reply": "Some games require a firmware dump to work properly. Click the following link for instructions on how to dump the firmware from your Nintendo Switch: <https://yuzu-emu.org/help/quickstart/#dumping-system-update-firmware>"},
"android": { "reply": "yuzu Android is available now in the Google Play Store! Download for free: <https://play.google.com/store/apps/details?id=org.yuzu.yuzu_emu> or support us by purchasing Early Access: <https://play.google.com/store/apps/details?id=org.yuzu.yuzu_emu.ea>"},
"firmware": { "reply": "Some games require a firmware dump to work properly. Click the following link for instructions on how to dump the firmware from your Nintendo Switch: <https://yuzu-emu.org/help/quickstart/#dumping-system-firmware>\nClick the following link to learn how to install it: <https://yuzu-emu.org/help/quickstart/#setting-up-the-decryption-keys-and-firmware>"},
"raptor": { "reply": "Raptor is a 3rd party service that provides a paid alternative to Nintendo Switch Online. We are not associated with Raptor in anyway. After key emulation members and the discerning public shared their opinion with us, we cut all ties with Raptor immediately in 2020. This new fork was made without our permission or cooperation and does not have permission to use the \"yuzu\" name or branding. At this time, we have no plans to add support for any 3rd party services, including Raptor.\n\nAs per our normal policies, we only provide support for our official releases and discussion of any unofficial builds isn't allowed."},
"role": { "reply": "To claim your Patreon Discord role, please follow this guide: <https://support.patreon.com/hc/en-us/articles/212052266-Get-my-Discord-role>"},
"release": { "reply": "yuzu builds can be manually downloaded on Github: <https://github.com/yuzu-emu/yuzu-mainline/releases>"}
"release": { "reply": "yuzu builds can be manually downloaded on Github: <https://github.com/yuzu-emu/yuzu-mainline/releases>"},
"rec": { "reply": "For information on recommended settings and GPU drivers for yuzu, please refer to this page: <https://community.citra-emu.org/t/recommended-settings/319349>"}
}
}

View file

@ -83,8 +83,8 @@ client.on('messageDelete', async (message) => {
}
if (!findArray(authorRoles, AllowedRoles)) {
const parent = (message.channel as discord.TextChannel).parent;
if (parent && IsIgnoredCategory(parent.name) === false) {
if (((message.content && message.content.startsWith('.') === false) || (message.attachments.size > 0)) && message.author?.bot === false) {
if (parent && !IsIgnoredCategory(parent.name)) {
if (((message.content && !message.content.startsWith('.')) || (message.attachments.size > 0)) && message.author?.bot === false) {
const messageAttachment = message.attachments.first()?.proxyURL;
const deletionEmbed = new discord.EmbedBuilder()
@ -114,7 +114,7 @@ client.on('messageUpdate', async (oldMessage, newMessage) => {
}
if (!findArray(authorRoles, AllowedRoles)) {
const parent = (oldMessage.channel as discord.TextChannel).parent;
if (parent && IsIgnoredCategory(parent.name) === false) {
if (parent && !IsIgnoredCategory(parent.name)) {
const oldM = oldMessage.cleanContent || '<no content>';
const newM = newMessage.cleanContent;
if (oldMessage.content !== newMessage.content && newM) {
@ -139,7 +139,7 @@ client.on('messageUpdate', async (oldMessage, newMessage) => {
});
client.on('messageCreate', async (message) => {
if (message.author.bot && message.content.startsWith('.ban') === false) { return; }
if (message.author.bot && !message.content.startsWith('.ban')) { return; }
if (message.guild == null && state.responses.pmReply) {
// We want to reply to PM attempts.
@ -180,7 +180,7 @@ client.on('messageCreate', async (message) => {
// Delete the message in the channel to force a cleanup.
await message.delete();
} else if (message.content.startsWith('.') && message.content.startsWith('..') === false) {
} else if (message.content.startsWith('.') && !message.content.startsWith('..')) {
// We want to make sure it's an actual command, not someone '...'-ing.
const cmd = message.content.split(' ', 1)[0].slice(1);
@ -212,7 +212,7 @@ client.on('messageCreate', async (message) => {
await cachedModules.quote.command(message, quoteResponse?.reply);
}
} catch (err) { logger.error(err); }
} else if (message.author.bot === false) {
} else if (!message.author.bot) {
// This is a normal channel message.
await Promise.all(
cachedTriggers.map(async function (trigger) {

View file

@ -16,7 +16,7 @@
"typeRoots": [
"./typings",
"./node_modules/@types/"
],
]
},
"include": [
"src/**/*"

27
typings/logdna-winston/index.d.ts vendored Normal file
View file

@ -0,0 +1,27 @@
// Taken from https://github.com/efugulin/logdna-winston/blob/master/index.d.ts
import { ConstructorOptions } from 'logdna';
import Transport from 'winston-transport';
declare class LogDNATransport extends Transport {
constructor(options: LogDNATransport.TransportOptions);
}
declare namespace LogDNATransport {
interface TransportOptions
extends Transport.TransportStreamOptions,
ConstructorOptions {
/** The LogDNA API key. */
key: string;
/** The name of this transport (default: "LogDNA"). */
name?: string;
/** Level of messages that this transport should log (default: "debug"). */
level?: string;
/**
* Allow meta objects to be passed with each line (default: false).
* See logger ConstructorOptions for more information.
*/
index_meta?: boolean;
}
}
export = LogDNATransport;

1000
yarn.lock

File diff suppressed because it is too large Load diff