You've already forked NitroSniper
mirror of
https://github.com/neoarz/NitroSniper.git
synced 2026-05-11 13:15:37 +02:00
feat: add option to not claim from yourself
This commit is contained in:
BIN
assets/icon.png
BIN
assets/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB |
15
index.tsx
15
index.tsx
@@ -6,14 +6,25 @@ dm @neoarz if u need help or have any questions
|
|||||||
https://github.com/neoarz/NitroSniper
|
https://github.com/neoarz/NitroSniper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
import { UserStore } from "@webpack/common";
|
||||||
|
|
||||||
const logger = new Logger("NitroSniper");
|
const logger = new Logger("NitroSniper");
|
||||||
const GiftActions = findByPropsLazy("redeemGiftCode");
|
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 startTime = 0;
|
||||||
let claiming = false;
|
let claiming = false;
|
||||||
const codeQueue: string[] = [];
|
const codeQueue: string[] = [];
|
||||||
@@ -51,6 +62,7 @@ export default definePlugin({
|
|||||||
authors: [Devs.neoarz],
|
authors: [Devs.neoarz],
|
||||||
tags: ["Chat", "Utility"],
|
tags: ["Chat", "Utility"],
|
||||||
searchTerms: ["nitro", "gift", "redeem", "snipe"],
|
searchTerms: ["nitro", "gift", "redeem", "snipe"],
|
||||||
|
settings,
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
resetState();
|
resetState();
|
||||||
@@ -59,6 +71,7 @@ export default definePlugin({
|
|||||||
flux: {
|
flux: {
|
||||||
MESSAGE_CREATE({ message }) {
|
MESSAGE_CREATE({ message }) {
|
||||||
if (!message.content) return;
|
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})/);
|
const match = message.content.match(/(?:discord\.gift\/|discord\.com\/gifts?\/)([a-zA-Z0-9]{16,24})/);
|
||||||
if (!match) return;
|
if (!match) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user