2020-03-14 19:40:24 +01:00
//META{"name":"InAppNotifications","source":"https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/InAppNotifications/InAppNotifications.plugin.js","website":"https://1lighty.github.io/BetterDiscordStuff/?plugin=InAppNotifications"}*//
2020-03-02 18:03:21 +01:00
/ * @ c c _ o n
@ if ( @ _jscript )
// Offer to self-install for clueless users that try to run this directly.
var shell = WScript . CreateObject ( 'WScript.Shell' ) ;
var fs = new ActiveXObject ( 'Scripting.FileSystemObject' ) ;
var pathPlugins = shell . ExpandEnvironmentStrings ( '%APPDATA%\\BetterDiscord\\plugins' ) ;
var pathSelf = WScript . ScriptFullName ;
// Put the user at ease by addressing them in the first person
shell . Popup ( 'It looks like you\'ve mistakenly tried to run me directly. \n(Don\'t do that!)' , 0 , 'I\'m a plugin for BetterDiscord' , 0x30 ) ;
if ( fs . GetParentFolderName ( pathSelf ) === fs . GetAbsolutePathName ( pathPlugins ) ) {
shell . Popup ( 'I\'m in the correct folder already.\nJust reload Discord with Ctrl+R.' , 0 , 'I\'m already installed' , 0x40 ) ;
} else if ( ! fs . FolderExists ( pathPlugins ) ) {
shell . Popup ( 'I can\'t find the BetterDiscord plugins folder.\nAre you sure it\'s even installed?' , 0 , 'Can\'t install myself' , 0x10 ) ;
} else if ( shell . Popup ( 'Should I copy myself to BetterDiscord\'s plugins folder for you?' , 0 , 'Do you need some help?' , 0x34 ) === 6 ) {
fs . CopyFile ( pathSelf , fs . BuildPath ( pathPlugins , fs . GetFileName ( pathSelf ) ) , true ) ;
// Show the user where to put plugins in the future
shell . Exec ( 'explorer ' + pathPlugins ) ;
shell . Popup ( 'I\'m installed!\nJust reload Discord with Ctrl+R.' , 0 , 'Successfully installed' , 0x40 ) ;
}
WScript . Quit ( ) ;
@ else @ * /
/ *
* Copyright © 2019 - 2020 , _Lighty _
* All rights reserved .
* Code may not be redistributed , modified or otherwise taken without explicit permission .
* /
var InAppNotifications = ( ( ) => {
/* Setup */
const config = {
main : 'index.js' ,
info : {
name : 'InAppNotifications' ,
authors : [
{
name : 'Lighty' ,
discord _id : '239513071272329217' ,
github _username : 'LightyPon' ,
twitter _username : ''
}
] ,
2020-03-14 19:40:24 +01:00
version : '1.0.2' ,
2020-03-02 18:03:21 +01:00
description : 'Show a notification in Discord when someone sends a message, just like on mobile.' ,
github : 'https://github.com/1Lighty' ,
github _raw : 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/InAppNotifications/InAppNotifications.plugin.js'
} ,
defaultConfig : [
{
name : 'Ignore DND mode' ,
id : 'dndIgnore' ,
type : 'switch' ,
value : true
}
] ,
changelog : [
{
2020-03-14 19:40:24 +01:00
title : 'was requested' ,
type : 'added' ,
items : [ "Desktop notifications now don't show if Discord is focused, while in-app ones do." ]
2020-03-05 16:16:16 +01:00
}
2020-03-02 18:03:21 +01:00
]
} ;
/* Build */
const buildPlugin = ( [ Plugin , Api ] ) => {
const { ContextMenu , EmulatedTooltip , Toasts , Settings , Popouts , Modals , Utilities , WebpackModules , Filters , DiscordModules , ColorConverter , DOMTools , DiscordClasses , DiscordSelectors , ReactTools , ReactComponents , DiscordAPI , Logger , Patcher , PluginUpdater , PluginUtilities , DiscordClassModules , Structs } = Api ;
2020-03-05 16:16:16 +01:00
const { React , ModalStack , ContextMenuActions , ContextMenuItem , ContextMenuItemsGroup , ReactDOM , ChannelStore , GuildStore , UserStore , DiscordConstants , Dispatcher , GuildMemberStore , GuildActions , SwitchRow , EmojiUtils , RadioGroup , Permissions , TextElement , FlexChild , PopoutOpener , Textbox , RelationshipStore , WindowInfo , UserSettingsStore , NavigationUtils , UserNameResolver } = DiscordModules ;
2020-03-02 18:03:21 +01:00
const LurkerStore = WebpackModules . getByProps ( 'isLurking' ) ;
const MuteStore = WebpackModules . getByProps ( 'allowNoMessages' ) ;
const isMentionedUtils = WebpackModules . getByProps ( 'isRawMessageMentioned' ) ;
const ParserModule = WebpackModules . getByProps ( 'parseAllowLinks' , 'parse' ) ;
const MessageClasses = WebpackModules . getByProps ( 'username' , 'messageContent' ) ;
const MarkupClassname = XenoLib . getClass ( 'markup' ) ;
2020-03-05 16:16:16 +01:00
const Messages = ( WebpackModules . getByProps ( 'Messages' ) || { } ) . Messages ;
const SysMessageUtils = WebpackModules . getByProps ( 'getSystemMessageUserJoin' , 'stringify' ) ;
const MessageParseUtils = ( WebpackModules . getByProps ( 'parseAndRebuild' , 'default' ) || { } ) . default ;
2020-03-14 19:40:24 +01:00
const CUser = WebpackModules . getByPrototypes ( 'getAvatarSource' , 'isLocalBot' ) ;
2020-03-02 18:03:21 +01:00
return class InAppNotifications extends Plugin {
constructor ( ) {
super ( ) ;
XenoLib . changeName ( _ _filename , 'InAppNotifications' ) ;
const oOnStart = this . onStart . bind ( this ) ;
this . onStart = ( ) => {
try {
oOnStart ( ) ;
} catch ( e ) {
Logger . stacktrace ( 'Failed to start!' , e ) ;
PluginUpdater . checkForUpdate ( this . name , this . version , this . _config . info . github _raw ) ;
XenoLib . Notifications . error ( ` [** ${ this . name } **] Failed to start! Please update it, press CTRL + R, or ${ GuildStore . getGuild ( XenoLib . supportServerId ) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)' } for further assistance. ` , { timeout : 0 } ) ;
try {
this . onStop ( ) ;
} catch ( e ) { }
}
} ;
const oMESSAGE _CREATE = this . MESSAGE _CREATE . bind ( this ) ;
this . MESSAGE _CREATE = e => {
try {
oMESSAGE _CREATE ( e ) ;
} catch ( e ) {
this . errorCount ++ ;
if ( this . errorCount >= 10 ) {
2020-03-15 12:50:57 +01:00
Logger . stacktrace ( 'Error in MESSAGE_CREATE dispatch handler' , e ) ;
2020-03-02 18:03:21 +01:00
PluginUpdater . checkForUpdate ( this . name , this . version , this . _config . info . github _raw ) ;
XenoLib . Notifications . error ( ` [** ${ this . name } **] Plugin is throwing errors and is in a broken state, please update it or ${ GuildStore . getGuild ( XenoLib . supportServerId ) ? 'go to <#639665366380838924>' : '[join my support server](https://discord.gg/NYvWdN5)' } for further assistance. ` , { timeout : 0 } ) ;
try {
this . onStop ( ) ;
} catch ( e ) { }
}
}
} ;
2020-03-15 12:50:57 +01:00
try {
ModalStack . popWithKey ( ` ${ this . name } _DEP_MODAL ` ) ;
} catch ( e ) { }
2020-03-02 18:03:21 +01:00
}
onStart ( ) {
this . errorCount = 0 ;
Dispatcher . subscribe ( 'MESSAGE_CREATE' , this . MESSAGE _CREATE ) ;
2020-03-14 19:40:24 +01:00
this . patchAll ( ) ;
2020-03-02 18:03:21 +01:00
PluginUtilities . addStyle (
this . short + '-CSS' ,
`
. IAN - message {
padding - left : 40 px ;
position : relative ;
min - height : 36 px ;
pointer - events : none ;
}
. IAN - message . IAN - avatar {
left : - 2 px ;
pointer - events : none ;
width : 32 px ;
height : 32 px ;
top : 0 ;
position : absolute ;
border - radius : 50 % ;
}
. IAN - message . $ { MessageClasses . username . split ( ' ' ) [ 0 ] } {
font - size : 0.9 rem ;
line - height : unset ;
}
. IAN - message . $ { MarkupClassname . split ( ' ' ) [ 0 ] } {
line - height : unset ;
}
. IAN - message . $ { MarkupClassname . split ( ' ' ) [ 0 ] } , . IAN - message . $ { MessageClasses . username . split ( ' ' ) [ 0 ] } {
overflow : hidden
}
`
) ;
}
onStop ( ) {
Dispatcher . unsubscribe ( 'MESSAGE_CREATE' , this . MESSAGE _CREATE ) ;
2020-03-14 19:40:24 +01:00
Patcher . unpatchAll ( ) ;
2020-03-02 18:03:21 +01:00
PluginUtilities . removeStyle ( this . short + '-CSS' ) ;
}
/* zlib uses reference to defaultSettings instead of a cloned object, which sets settings as default settings, messing everything up */
loadSettings ( defaultSettings ) {
return PluginUtilities . loadSettings ( this . name , Utilities . deepclone ( this . defaultSettings ? this . defaultSettings : defaultSettings ) ) ;
}
2020-03-05 16:16:16 +01:00
2020-03-02 18:03:21 +01:00
_shouldNotify ( iAuthor , iChannel ) {
if ( iChannel . isManaged ( ) ) return false ;
const guildId = iChannel . getGuildId ( ) ;
if ( guildId && LurkerStore . isLurking ( guildId ) ) return false ;
if ( iAuthor . id === DiscordAPI . currentUser . id || RelationshipStore . isBlocked ( iAuthor . id ) ) return false ;
if ( ! this . settings . dndIgnore && UserSettingsStore . status === DiscordConstants . StatusTypes . DND ) return false ;
if ( MuteStore . allowNoMessages ( iChannel ) ) return false ;
return true ;
}
shouldNotify ( message , iChannel , iAuthor ) {
if ( ! DiscordAPI . currentUser || ! iChannel || ! iAuthor ) return false ;
2020-03-05 16:16:16 +01:00
/* dunno what the func name is as this is copied from discord, so I named it _shouldNotify */
2020-03-02 18:03:21 +01:00
if ( ! this . _shouldNotify ( iAuthor , iChannel ) ) return false ;
if ( DiscordAPI . currentChannel && DiscordAPI . currentChannel . id === iChannel . id ) return false ;
2020-03-05 16:16:16 +01:00
/* channel has notif settings set to all messages */
2020-03-02 18:03:21 +01:00
if ( MuteStore . allowAllMessages ( iChannel ) ) return true ;
const everyoneSuppressed = MuteStore . isSuppressEveryoneEnabled ( iChannel . guild _id ) ;
const rolesSuppressed = MuteStore . isSuppressRolesEnabled ( iChannel . guild _id ) ;
2020-03-05 16:16:16 +01:00
/* only if mentioned, but only if settings allow */
2020-03-02 18:03:21 +01:00
return isMentionedUtils . isRawMessageMentioned ( message , DiscordAPI . currentUser . id , everyoneSuppressed , rolesSuppressed ) ;
}
2020-03-05 16:16:16 +01:00
getChannelName ( iChannel , iAuthor ) {
switch ( iChannel . type ) {
case DiscordConstants . ChannelTypes . GROUP _DM :
if ( '' !== iChannel . name ) return iChannel . name ;
const recipients = iChannel . recipients . map ( e => ( e === iAuthor . id ? iAuthor : UserStore . getUser ( e ) ) ) . filter ( e => e ) ;
return recipients . length > 0 ? recipients . map ( e => e . username ) . join ( ', ' ) : Messages . UNNAMED ;
case DiscordConstants . ChannelTypes . GUILD _ANNOUNCEMENT :
case DiscordConstants . ChannelTypes . GUILD _TEXT :
return '#' + iChannel . name ;
default :
return iChannel . name ;
}
}
getActivity ( e , t , n , r ) {
switch ( e . type ) {
case DiscordConstants . ChannelTypes . GUILD _ANNOUNCEMENT :
case DiscordConstants . ChannelTypes . GUILD _TEXT :
return t ;
case DiscordConstants . ChannelTypes . GROUP _DM :
return n ;
case DiscordConstants . ChannelTypes . DM :
default :
return r ;
}
}
makeTextChatNotification ( iChannel , message , iAuthor ) {
let author = UserNameResolver . getName ( iChannel . guild _id , iChannel . id , iAuthor ) ;
let channel = author ;
switch ( iChannel . type ) {
case DiscordConstants . ChannelTypes . GUILD _ANNOUNCEMENT :
case DiscordConstants . ChannelTypes . GUILD _TEXT :
const iGuild = GuildStore . getGuild ( iChannel . guild _id ) ;
if ( message . type === DiscordConstants . MessageTypes . DEFAULT || iGuild ) channel += ` ( ${ this . getChannelName ( iChannel ) } , ${ iGuild . name } ) ` ;
break ;
case DiscordConstants . ChannelTypes . GROUP _DM :
const newChannel = this . getChannelName ( iChannel , iAuthor ) ;
if ( ! iChannel . isManaged ( ) || ! iAuthor . bot || channel !== newChannel ) channel += ` ( ${ newChannel } ) ` ;
}
let d = message . content ;
if ( message . activity && message . application ) {
const targetMessage = message . activity . type === DiscordConstants . ActivityActionTypes . JOIN ? this . getActivity ( iChannel , Messages . NOTIFICATION _MESSAGE _CREATE _GUILD _ACTIVITY _JOIN , Messages . NOTIFICATION _MESSAGE _CREATE _GROUP _DM _ACTIVITY _JOIN , Messages . NOTIFICATION _MESSAGE _CREATE _DM _ACTIVITY _JOIN ) : this . getActivity ( iChannel , Messages . NOTIFICATION _MESSAGE _CREATE _GUILD _ACTIVITY _SPECTATE , Messages . NOTIFICATION _MESSAGE _CREATE _GROUP _DM _ACTIVITY _SPECTATE , Messages . NOTIFICATION _MESSAGE _CREATE _DM _ACTIVITY _SPECTATE ) ;
d = targetMessage . format ( { user : author , game : message . application . name } ) ;
} else if ( message . activity && message . activity . type === DiscordConstants . ActivityActionTypes . LISTEN ) {
const targetMessage = this . getActivity ( iChannel , Messages . NOTIFICATION _MESSAGE _CREATE _GUILD _ACTIVITY _LISTEN , Messages . NOTIFICATION _MESSAGE _CREATE _GROUP _DM _ACTIVITY _LISTEN , Messages . NOTIFICATION _MESSAGE _CREATE _DM _ACTIVITY _LISTEN ) ;
d = targetMessage . format ( { user : author } ) ;
} else if ( message . type !== DiscordConstants . MessageTypes . DEFAULT ) {
const content = SysMessageUtils . stringify ( message ) ;
if ( ! content ) return null ;
d = MessageParseUtils . unparse ( content , iChannel . id , true ) ;
}
if ( ! d . length && message . attachments . length ) d = Messages . NOTIFICATION _BODY _ATTACHMENT . format ( { filename : message . attachments [ 0 ] . filename } ) ;
if ( ! d . length && message . embeds . length ) {
const embed = message . embeds [ 0 ] ;
if ( embed . description ) d = embed . title ? embed . title + ': ' + embed . description : embed . description ;
else if ( embed . title ) d = embed . title ;
else if ( embed . fields ) {
const field = embed . fields [ 0 ] ;
d = field . name + ': ' + field . value ;
}
}
return {
icon : iAuthor . getAvatarURL ( ) ,
title : channel ,
content : d
} ;
}
2020-03-02 18:03:21 +01:00
MESSAGE _CREATE ( { channelId , message } ) {
const iChannel = ChannelStore . getChannel ( channelId ) ;
2020-03-14 19:40:24 +01:00
let iAuthor = UserStore . getUser ( message . author . id ) ;
if ( ! iAuthor ) {
iAuthor = new CUser ( message . author ) ;
UserStore . getUsers ( ) [ message . author . id ] = iAuthor ;
}
2020-03-02 18:03:21 +01:00
if ( ! iChannel || ! iAuthor ) return ;
if ( ! this . shouldNotify ( message , iChannel , iAuthor ) ) return ;
2020-03-05 16:16:16 +01:00
const notif = this . makeTextChatNotification ( iChannel , message , iAuthor ) ;
if ( ! notif ) return ; /* wah */
2020-03-02 18:03:21 +01:00
this . showNotification ( notif , iChannel ) ;
}
showNotification ( notif , iChannel ) {
const notificationId = XenoLib . Notifications . info (
React . createElement (
'div' ,
{
className : 'IAN-message'
} ,
React . createElement ( 'img' , {
className : 'IAN-avatar' ,
src : notif . icon
} ) ,
React . createElement (
'span' ,
{
className : MessageClasses . username
} ,
notif . title
) ,
2020-03-05 16:16:16 +01:00
React . createElement ( 'div' , { className : XenoLib . joinClassNames ( MarkupClassname , MessageClasses . messageContent ) } , ParserModule . parse ( notif . content , true , { channelId : iChannel . id } ) )
2020-03-02 18:03:21 +01:00
) ,
{
timeout : 5000 ,
onClick : ( ) => {
NavigationUtils . transitionTo ( ` /channels/ ${ iChannel . guild _id || '@me' } / ${ iChannel . id } ` ) ;
XenoLib . Notifications . remove ( notificationId ) ;
}
}
) ;
}
2020-03-14 19:40:24 +01:00
/* PATCHES */
patchAll ( ) {
Utilities . suppressErrors ( this . patchShouldNotify . bind ( this ) , 'shouldNotify patch' ) ( ) ;
}
patchShouldNotify ( ) {
Patcher . after ( WebpackModules . getByProps ( 'shouldNotify' ) , 'shouldNotify' , ( ) => ( WindowInfo . isFocused ( ) ? false : undefined ) ) ;
}
/* PATCHES */
2020-03-02 18:03:21 +01:00
showChangelog ( footer ) {
XenoLib . showChangelog ( ` ${ this . name } has been updated! ` , this . version , this . _config . changelog ) ;
}
getSettingsPanel ( ) {
return this . buildSettingsPanel ( ) . getElement ( ) ;
}
get [ Symbol . toStringTag ] ( ) {
return 'Plugin' ;
}
get name ( ) {
return config . info . name ;
}
get short ( ) {
let string = '' ;
for ( let i = 0 , len = config . info . name . length ; i < len ; i ++ ) {
const char = config . info . name [ i ] ;
if ( char === char . toUpperCase ( ) ) string += char ;
}
return string ;
}
get author ( ) {
return config . info . authors . map ( author => author . name ) . join ( ', ' ) ;
}
get version ( ) {
return config . info . version ;
}
get description ( ) {
return config . info . description ;
}
} ;
} ;
/* Finalize */
let ZeresPluginLibraryOutdated = false ;
let XenoLibOutdated = false ;
try {
if ( global . BdApi && 'function' == typeof BdApi . getPlugin ) {
const i = ( i , n ) => ( ( i = i . split ( '.' ) . map ( i => parseInt ( i ) ) ) , ( n = n . split ( '.' ) . map ( i => parseInt ( i ) ) ) , ! ! ( n [ 0 ] > i [ 0 ] ) || ! ! ( n [ 0 ] == i [ 0 ] && n [ 1 ] > i [ 1 ] ) || ! ! ( n [ 0 ] == i [ 0 ] && n [ 1 ] == i [ 1 ] && n [ 2 ] > i [ 2 ] ) ) ,
n = ( n , e ) => n && n . _config && n . _config . info && n . _config . info . version && i ( n . _config . info . version , e ) ,
e = BdApi . getPlugin ( 'ZeresPluginLibrary' ) ,
2020-03-14 19:40:24 +01:00
author = BdApi . getPlugin ( 'XenoLib' ) ;
2020-03-15 12:50:57 +01:00
n ( e , '1.2.11' ) && ( ZeresPluginLibraryOutdated = ! 0 ) , n ( author , '1.3.14' ) && ( XenoLibOutdated = ! 0 ) ;
2020-03-02 18:03:21 +01:00
}
} catch ( i ) {
console . error ( 'Error checking if libraries are out of date' , i ) ;
}
return ! global . ZeresPluginLibrary || ! global . XenoLib || ZeresPluginLibraryOutdated || XenoLibOutdated
? class {
2020-03-15 12:50:57 +01:00
constructor ( ) {
this . _XL _PLUGIN = true ;
}
2020-03-02 18:03:21 +01:00
getName ( ) {
return this . name . replace ( /\s+/g , '' ) ;
}
getAuthor ( ) {
return this . author ;
}
getVersion ( ) {
return this . version ;
}
getDescription ( ) {
return this . description ;
}
stop ( ) { }
load ( ) {
2020-03-15 12:50:57 +01:00
const a = BdApi . findModuleByProps ( 'isModalOpen' ) ;
if ( a && a . isModalOpen ( ` ${ this . name } _DEP_MODAL ` ) ) return ;
const b = ! global . XenoLib ,
c = ! global . ZeresPluginLibrary ,
d = ( b && c ) || ( ( b || c ) && ( XenoLibOutdated || ZeresPluginLibraryOutdated ) ) ,
2020-03-14 19:40:24 +01:00
e = ( ( ) => {
2020-03-15 12:50:57 +01:00
let a = '' ;
return b || c ? ( a += ` Missing ${ XenoLibOutdated || ZeresPluginLibraryOutdated ? ' and outdated' : '' } ` ) : ( XenoLibOutdated || ZeresPluginLibraryOutdated ) && ( a += ` Outdated ` ) , ( a += ` ${ d ? 'Libraries' : 'Library' } ` ) , a ;
2020-03-12 16:23:56 +01:00
} ) ( ) ,
2020-03-15 12:50:57 +01:00
f = ( ( ) => {
let a = ` The ${ d ? 'libraries' : 'library' } ` ;
return b || XenoLibOutdated ? ( ( a += 'XenoLib ' ) , ( c || ZeresPluginLibraryOutdated ) && ( a += 'and ZeresPluginLibrary ' ) ) : ( c || ZeresPluginLibraryOutdated ) && ( a += 'ZeresPluginLibrary ' ) , ( a += ` required for ${ this . name } ${ d ? 'are' : 'is' } ${ b || c ? 'missing' : '' } ${ XenoLibOutdated || ZeresPluginLibraryOutdated ? ( b || c ? ' and/or outdated' : 'outdated' ) : '' } . ` ) , a ;
} ) ( ) ,
g = BdApi . findModuleByProps ( 'push' , 'update' , 'pop' , 'popWithKey' ) ,
h = BdApi . findModuleByProps ( 'Sizes' , 'Weights' ) ,
i = BdApi . findModule ( a => a . defaultProps && a . key && 'confirm-modal' === a . key ( ) ) ,
j = ( ) => BdApi . getCore ( ) . alert ( e , ` ${ f } <br/>Due to a slight mishap however, you'll have to download the libraries yourself. After opening the links, do CTRL + S to download the library.<br/> ${ c || ZeresPluginLibraryOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/rauenzi/BDPluginLibrary/blob/master/release/0PluginLibrary.plugin.js"target="_blank">Click here to download ZeresPluginLibrary</a>' : '' } ${ b || XenoLibOutdated ? '<br/><a href="http://betterdiscord.net/ghdl/?url=https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js"target="_blank">Click here to download XenoLib</a>' : '' } ` ) ;
if ( ! g || ! i || ! h ) return j ( ) ;
class k extends BdApi . React . PureComponent {
2020-03-02 18:03:21 +01:00
constructor ( a ) {
super ( a ) , ( this . state = { hasError : ! 1 } ) ;
}
2020-03-15 12:50:57 +01:00
componentDidCatch ( a ) {
2020-03-02 18:03:21 +01:00
console . error ( ` Error in ${ this . props . label } , screenshot or copy paste the error above to Lighty for help. ` ) , this . setState ( { hasError : ! 0 } ) , 'function' == typeof this . props . onError && this . props . onError ( a ) ;
}
render ( ) {
return this . state . hasError ? null : this . props . children ;
}
}
2020-03-15 12:50:57 +01:00
class l extends i {
submitModal ( ) {
this . props . onConfirm ( ) ;
}
}
let m = ! 1 ;
const n = g . push (
a =>
2020-03-02 18:03:21 +01:00
BdApi . React . createElement (
2020-03-15 12:50:57 +01:00
k ,
{
label : 'missing dependency modal' ,
onError : ( ) => {
g . popWithKey ( n ) , j ( ) ;
}
} ,
BdApi . React . createElement (
l ,
Object . assign (
{
header : e ,
children : [ BdApi . React . createElement ( h , { color : h . Colors . PRIMARY , children : [ ` ${ f } Please click Download Now to download ${ d ? 'them' : 'it' } . ` ] } ) ] ,
red : ! 1 ,
confirmText : 'Download Now' ,
cancelText : 'Cancel' ,
onConfirm : ( ) => {
if ( m ) return ;
m = ! 0 ;
const a = require ( 'request' ) ,
b = require ( 'fs' ) ,
c = require ( 'path' ) ,
d = ( ) => {
( global . XenoLib && ! XenoLibOutdated ) || a ( 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js' , ( a , d , e ) => ( a ? j ( ) : void b . writeFile ( c . join ( window . ContentManager . pluginsFolder , '1XenoLib.plugin.js' ) , e , ( ) => { } ) ) ) ;
2020-03-02 18:03:21 +01:00
} ;
2020-03-15 12:50:57 +01:00
! global . ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a ( 'https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js' , ( a , e , f ) => ( a ? j ( ) : void ( b . writeFile ( c . join ( window . ContentManager . pluginsFolder , '0PluginLibrary.plugin.js' ) , f , ( ) => { } ) , d ( ) ) ) ) : d ( ) ;
}
} ,
a
)
2020-03-02 18:03:21 +01:00
)
2020-03-15 12:50:57 +01:00
) ,
void 0 ,
` ${ this . name } _DEP_MODAL `
2020-03-02 18:03:21 +01:00
) ;
}
start ( ) { }
get [ Symbol . toStringTag ] ( ) {
return 'Plugin' ;
}
get name ( ) {
return config . info . name ;
}
get short ( ) {
let string = '' ;
for ( let i = 0 , len = config . info . name . length ; i < len ; i ++ ) {
const char = config . info . name [ i ] ;
if ( char === char . toUpperCase ( ) ) string += char ;
}
return string ;
}
get author ( ) {
return config . info . authors . map ( author => author . name ) . join ( ', ' ) ;
}
get version ( ) {
return config . info . version ;
}
get description ( ) {
return config . info . description ;
}
}
: buildPlugin ( global . ZeresPluginLibrary . buildPlugin ( config ) ) ;
} ) ( ) ;
/*@end@*/