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 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 DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0].default
let relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0]
let DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0]
const blocked = {}
@ -43,12 +43,12 @@ export default new class AntiBotDM {
Utils.showToast(`[AdBlock]: Blocked ${ev.message.author.username}#${ev.message.author.discriminator}`, {
"type": "warning"
})
if(!relationShipModule)relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0].default
relationShipModule.addRelationship(ev.message.author.id, {
if(!relationShipModule)relationShipModule = BDModules.get(e => e.default && e.default.addRelationship)[0]
relationShipModule.default.addRelationship(ev.message.author.id, {
location: "ContextMenu"
}, 2)
if(!DMModule)DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0].default
DMModule.closePrivateChannel(channel.id, false)
if(!DMModule)DMModule = BDModules.get(e => e.default && e.default.closePrivateChannel)[0]
DMModule.default.closePrivateChannel(channel.id, false)
}
}
}

View File

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

View File

@ -1,8 +1,18 @@
let req
setReq()
class Modules {
/** use this as less as possible */
static get modules(){
let cache = webpackJsonp.push([[],{['']:(_,e,r)=>{e.cache=r.c}},[['']]]).cache
return Object.values(cache)
if(req){
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){
if(typeof ids === "function"){
@ -28,4 +38,16 @@ class Modules {
module.exports = 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