Created
March 18, 2023 18:21
-
-
Save busybox11/ca0501da3c8eb338ed0932014c50049a to your computer and use it in GitHub Desktop.
WIP dont mind me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name MSN Wizz | |
* @author busybox11 | |
* @description Bring back MSN's Wizz to Discord! | |
* @version 0.0.1 | |
*/ | |
module.exports = (() => { | |
const config = { | |
info: { | |
name: "MSN Wizz", | |
authors: [ | |
{ | |
name: "busybox#2540", | |
discord_id: "310754542956314625", | |
github_username: "busybox11", | |
twitter_username: "chaoticvibing", | |
}, | |
], | |
version: "0.0.1", | |
description: "Bring back MSN's Wizz to Discord!", | |
github: undefined, | |
github_raw: undefined, | |
}, | |
defaultConfig: [], | |
}; | |
return !global.ZeresPluginLibrary | |
? class { | |
constructor() { | |
this._config = config; | |
} | |
getName() { | |
return config.info.name; | |
} | |
getAuthor() { | |
return config.info.authors.map((a) => a.name).join(", "); | |
} | |
getDescription() { | |
return config.info.description; | |
} | |
getVersion() { | |
return config.info.version; | |
} | |
load() { | |
BdApi.showConfirmationModal( | |
"Library Missing", | |
`The library plugin needed for ${config.info.name} is missing. Please click Download Now to install it.`, | |
{ | |
confirmText: "Download Now", | |
cancelText: "Cancel", | |
onConfirm: () => { | |
require("request").get( | |
"https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js", | |
async (err, res, body) => { | |
if (err) | |
return require("electron").shell.openExternal( | |
"https://betterdiscord.app/Download?id=9" | |
); | |
await new Promise((r) => | |
require("fs").writeFile( | |
require("path").join( | |
BdApi.Plugins.folder, | |
"0PluginLibrary.plugin.js" | |
), | |
body, | |
r | |
) | |
); | |
} | |
); | |
}, | |
} | |
); | |
} | |
start() {} | |
stop() {} | |
} | |
: (([Plugin, Api]) => { | |
const plugin = (Plugin, Api) => { | |
try { | |
const { | |
DiscordModules: { Dispatcher }, | |
} = Api; | |
return class MSNWizz extends Plugin { | |
constructor() { | |
super(); | |
} | |
onStart() { | |
Dispatcher.subscribe("MESSAGE_CREATE", this.messageEvent); | |
} | |
messageEvent = async (message) => { | |
if (!message.guildId) { | |
if ( | |
message.message?.content === "Wizz!" && | |
message.message?.state !== "SENDING" && | |
!message?.optimistic | |
) { | |
const wizzURL = | |
"https://www.cjoint.com/doc/15_11/EKsvxHzqcDk_Wizz.mp3"; | |
const wizz = new Audio(wizzURL); | |
wizz.play(); | |
BdApi.showToast("You've been wizzed by " + message.message.author.username, { | |
type: "info", | |
icon: true, | |
timeout: 5000 | |
}); | |
} | |
} | |
}; | |
onStop() { | |
Dispatcher.unsubscribe("MESSAGE_CREATE", this.messageEvent); | |
} | |
}; | |
} catch (e) { | |
console.error(e); | |
} | |
}; | |
return plugin(Plugin, Api); | |
})(global.ZeresPluginLibrary.buildPlugin(config)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment