Skip to content

Instantly share code, notes, and snippets.

@py7hon
Created July 11, 2026 11:46
Show Gist options
  • Select an option

  • Save py7hon/6caf6ded09139495640400167bf0a585 to your computer and use it in GitHub Desktop.

Select an option

Save py7hon/6caf6ded09139495640400167bf0a585 to your computer and use it in GitHub Desktop.
Device/Platfrom Spoofer
import { definePluginSettings } from "@api/Settings";
import { Notice } from "@components/Notice";
import definePlugin, { OptionType } from "@utils/types";
import { UserStore } from "@webpack/common";
const settings = definePluginSettings({
platform: {
type: OptionType.SELECT,
description: "The platform that will be shown",
restartNeeded: true,
options: [
{
label: "Desktop",
value: "desktop",
default: true,
},
{
label: "Web",
value: "web",
},
{
label: "Android",
value: "android"
},
{
label: "iOS",
value: "ios"
},
{
label: "Xbox",
value: "xbox",
},
{
label: "Playstation",
value: "playstation",
},
{
label: "VR",
value: "vr",
},
]
}
});
export default definePlugin({
name: "PlatformSpoofer",
description: "Spoof the platform or device you are using",
tags: ["Utility"],
authors: ["jack"],
settingsAboutComponent: () => (
<Notice.Warning>
{("We can't guarantee this plugin won't get you warned or banned.")}
</Notice.Warning>
),
settings: settings,
patches: [
{
find: "_doIdentify(){",
replacement: [
{
match: /window._ws=null,null!=\i/,
replace: "false"
},
{
match: /(?<="GatewaySocket"\)\}\),properties:)(\i)/,
replace: "{...$1,...$self.getPlatform(true)}"
},
]
},
{
find: '"2025-01-virtual-currency-rollout"',
replacement: [
{
match: /enabled:\i\.(?:get|use)Config\(\i\)\.enabled/g,
replace: "enabled:false"
}
]
},
],
getPlatform(bypass, userId?: any) {
const platform = settings.store.platform ?? "desktop";
if (bypass || userId === UserStore.getCurrentUser().id) {
switch (platform) {
case "desktop":
return { browser: "Discord Client" };
case "web":
return { browser: "Discord Web" };
case "ios":
return { browser: "Discord iOS" };
case "android":
return { browser: "Discord Android" };
case "xbox":
return { browser: "Discord Embedded" };
case "playstation":
return { browser: "Discord Embedded" };
case "vr":
return { browser: "Discord VR" };
default:
return null;
}
}
return null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment