feat: add option to not claim from yourself

This commit is contained in:
neoarz
2026-04-22 13:03:22 -04:00
parent 8f885d8db1
commit 2d003eaaee
3 changed files with 14 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 MiB

View File

@@ -6,14 +6,25 @@ dm @neoarz if u need help or have any questions
https://github.com/neoarz/NitroSniper
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { UserStore } from "@webpack/common";
const logger = new Logger("NitroSniper");
const GiftActions = findByPropsLazy("redeemGiftCode");
const settings = definePluginSettings({
ignoreOwnGiftLinks: {
type: OptionType.BOOLEAN,
description: "Do not redeem Nitro gift links from messages sent by you.",
default: false,
restartNeeded: false
}
});
let startTime = 0;
let claiming = false;
const codeQueue: string[] = [];
@@ -51,6 +62,7 @@ export default definePlugin({
authors: [Devs.neoarz],
tags: ["Chat", "Utility"],
searchTerms: ["nitro", "gift", "redeem", "snipe"],
settings,
start() {
resetState();
@@ -59,6 +71,7 @@ export default definePlugin({
flux: {
MESSAGE_CREATE({ message }) {
if (!message.content) return;
if (settings.store.ignoreOwnGiftLinks && message.author?.id === UserStore.getCurrentUser()?.id) return;
const match = message.content.match(/(?:discord\.gift\/|discord\.com\/gifts?\/)([a-zA-Z0-9]{16,24})/);
if (!match) return;