This commit is contained in:
Jean Ouina 2020-05-30 15:12:10 +02:00
parent d37bac0f10
commit a20bb842e3
6 changed files with 47 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,8 @@ import Utils from "./utils"
const dispatcher = window.Lightcord.DiscordModules.dispatcher const dispatcher = window.Lightcord.DiscordModules.dispatcher
const ChannelModule = BDModules.get(e => e.default && e.default.getChannel && e.default.hasChannel)[0].default const ChannelModule = BDModules.get(e => e.default && e.default.getChannel && e.default.hasChannel)[0].default
let relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0].default let relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0]
let DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0].default let DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0]
const blocked = {} const blocked = {}
@ -43,12 +43,12 @@ export default new class AntiBotDM {
Utils.showToast(`[AdBlock]: Blocked ${ev.message.author.username}#${ev.message.author.discriminator}`, { Utils.showToast(`[AdBlock]: Blocked ${ev.message.author.username}#${ev.message.author.discriminator}`, {
"type": "warning" "type": "warning"
}) })
if(!relationShipModule)relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0].default if(!relationShipModule)relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0]
relationShipModule.addRelationship(ev.message.author.id, { relationShipModule.default.addRelationship(ev.message.author.id, {
location: "ContextMenu" location: "ContextMenu"
}, 2) }, 2)
if(!DMModule)DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0].default if(!DMModule)DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0]
DMModule.closePrivateChannel(channel.id, false) DMModule.default.closePrivateChannel(channel.id, false)
} }
} }
} }

View File

@ -19,7 +19,7 @@ exports.init = function(){
} }
hasInit = true hasInit = true
let readyInterval = setInterval(()=>{ let readyInterval = setInterval(()=>{
//events.emit("debug", `[INIT] try ${tries++} loading LightCord`) events.emit("debug", `[INIT] try ${tries++} loading LightCord`)
try{ try{
if(!global.webpackJsonp)return if(!global.webpackJsonp)return
if(!ModuleLoader.get(4))return if(!ModuleLoader.get(4))return
@ -42,7 +42,7 @@ async function privateInit(){
hasPrivateInit = true hasPrivateInit = true
//disabling sentry //disabling sentry
BDModules.get(e => e.getCurrentHub)[0].getCurrentHub().getClient().getOptions().enabled = false ModuleLoader.get(e => e.getCurrentHub)[0].getCurrentHub().getClient().getOptions().enabled = false
// setting react in require cache // setting react in require cache
try{ try{
@ -58,8 +58,8 @@ async function privateInit(){
window.ReactDOM = ReactDOM window.ReactDOM = ReactDOM
} }
let original = BDModules.get((e) => e.createSound)[0].createSound let original = ModuleLoader.get((e) => e.createSound)[0].createSound
BDModules.get((e) => e.createSound)[0].createSound = function(sound){ ModuleLoader.get((e) => e.createSound)[0].createSound = function(sound){
let isCalling = sound === "call_ringing_beat" || sound === "call_ringing" let isCalling = sound === "call_ringing_beat" || sound === "call_ringing"
if(isCalling){ if(isCalling){
let returned = original(...arguments) let returned = original(...arguments)
@ -178,9 +178,11 @@ async function privateInit(){
const Utils = window.Lightcord.BetterDiscord.Utils const Utils = window.Lightcord.BetterDiscord.Utils
delete window.Lightcord.BetterDiscord.Utils // security delete
await ensureExported(e => e.default && e.default.displayName == "AuthBox") await ensureExported(e => e.default && e.default.displayName == "AuthBox")
const classs = BDModules.get(e => e.default && e.default.displayName == "AuthBox") const classs = ModuleLoader.get(e => e.default && e.default.displayName == "AuthBox")
Utils.monkeyPatch(classs[0], "default", {after: (data) => { Utils.monkeyPatch(classs[0], "default", {after: (data) => {
const children = Utils.getNestedProp(data.returnValue, "props.children.props.children.props.children") const children = Utils.getNestedProp(data.returnValue, "props.children.props.children.props.children")
@ -238,11 +240,11 @@ function ensureGuildClasses(){
function ensureExported(filter){ function ensureExported(filter){
return new Promise((resolve) => { return new Promise((resolve) => {
let classs = BDModules.get(filter)[0] let classs = ModuleLoader.get(filter)[0]
if(classs)return resolve() if(classs)return resolve()
let intergay = setInterval(() => { let intergay = setInterval(() => {
classs = BDModules.get(filter)[0] classs = ModuleLoader.get(filter)[0]
if(classs){ if(classs){
clearInterval(intergay) clearInterval(intergay)
resolve() resolve()
@ -253,9 +255,9 @@ function ensureExported(filter){
} }
function getGuildClasses() { function getGuildClasses() {
const guildsWrapper = BDModules.get(e => e.wrapper && e.unreadMentionsBar)[0]; const guildsWrapper = ModuleLoader.get(e => e.wrapper && e.unreadMentionsBar)[0];
const guilds = BDModules.get(e => e.guildsError && e.selected)[0] const guilds = ModuleLoader.get(e => e.guildsError && e.selected)[0]
const pill = BDModules.get(e => e.blobContainer)[0] const pill = ModuleLoader.get(e => e.blobContainer)[0]
return Object.assign({}, guildsWrapper, guilds, pill); return Object.assign({}, guildsWrapper, guilds, pill);
} }

View File

@ -1,8 +1,18 @@
let req
setReq()
class Modules { class Modules {
/** use this as less as possible */
static get modules(){ static get modules(){
let cache = webpackJsonp.push([[],{['']:(_,e,r)=>{e.cache=r.c}},[['']]]).cache if(req){
return Object.values(cache) return Object.values(req.c).filter(e => e && e.exports)
}else{
setReq()
if(req){
return Object.values(req.c).filter(e => e && e.exports)
}else{
return []
}
}
} }
static get(ids, modules){ static get(ids, modules){
if(typeof ids === "function"){ if(typeof ids === "function"){
@ -28,4 +38,16 @@ class Modules {
module.exports = Modules module.exports = Modules
module.exports.default = Modules module.exports.default = Modules
global.BDModules = Modules global.BDModules = Modules
function setReq(){
try{
req = webpackJsonp.push([[], {__extra_id__: (module, exports, req) => module.exports = req}, [["__extra_id__"]]]);
if(req){
delete req.m.__extra_id__;
delete req.c.__extra_id__;
}
}catch(e){
req = undefined
}
}

@ -0,0 +1 @@
Subproject commit 1ff160b257662689a0abc76731ed643bf69fb3cf

@ -0,0 +1 @@
Subproject commit 6b1396d4516800c3e59e26cac6bd9bc8fa4def9a