-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2 plugins that arent on the bd store.
- Loading branch information
1 parent
6e97a5d
commit 096ffcf
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* @name DMHistory | ||
* @description Allows you to see users that DMs have closed or users you've directly messaged | ||
* @author kaan | ||
* @version 1.0.4 | ||
*/ | ||
|
||
const { Patcher, Webpack, React } = BdApi; | ||
|
||
class DMHistory { | ||
constructor() { | ||
this.Settings = BdApi.React.createContext(); | ||
this.PrivateDMs = Webpack.getByKeys("openPrivateChannel"); | ||
this.FriendRow = Webpack.getByStrings("isActiveRow:!1"); | ||
this.PresenceStore = BdApi.Webpack.getStore("PresenceStore"); | ||
this.UserStore = BdApi.Webpack.getStore("UserStore"); | ||
this.ChannelStore = BdApi.Webpack.getStore("ChannelStore"); | ||
} | ||
|
||
start() { | ||
this.Patch = Patcher.before( | ||
"IforgotANameIaHateBetterDiscord", | ||
this.PrivateDMs, | ||
"closePrivateChannel", | ||
(a, b) => { | ||
const ClosedChannel = b[0]; | ||
const Channel = this.ChannelStore.getChannel(ClosedChannel); | ||
|
||
Channel.recipients.forEach( (userId) => { | ||
let Users = BdApi.Data.load("DMHistory", "ClosedUsers") || []; | ||
if (!Users?.includes(userId)) Users.push(userId); | ||
BdApi.Data.save("DMHistory", "ClosedUsers", Users); | ||
} ) | ||
} | ||
); | ||
} | ||
|
||
stop() { | ||
this.Patch(); | ||
} | ||
|
||
getSettingsPanel() { | ||
return React.createElement( | ||
this.Settings.Provider, | ||
{ value: this }, | ||
React.createElement(this.SettingsPanel.bind(this)) | ||
); | ||
} | ||
|
||
SettingsPanel() { | ||
const Users = BdApi.Data.load("DMHistory", "ClosedUsers") || []; | ||
|
||
const UserRows = []; | ||
Users.forEach( (userId) => { | ||
if (userId) { | ||
UserRows.push( | ||
React.createElement(this.FriendRow, { | ||
user: this.UserStore.getUser(userId), | ||
activities: [], | ||
type: 1, | ||
status: this.PresenceStore.getStatus(userId), | ||
}) | ||
); | ||
} | ||
}) | ||
|
||
const maxPanelHeight = "300px"; | ||
const panelStyle = { | ||
maxHeight: maxPanelHeight, | ||
overflowY: "auto", | ||
}; | ||
|
||
return React.createElement("div", { style: panelStyle }, UserRows); | ||
} | ||
} | ||
|
||
module.exports = DMHistory; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @name FileNameRandomization | ||
* @author kaan | ||
* @description somefile.txt = dsfDFHJhd4u4r.txt | ||
*/ | ||
|
||
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | ||
|
||
module.exports = class FileNameRandomization { | ||
start() { | ||
this.Main = BdApi.Patcher.after("dfdsf", BdApi.Webpack.getByKeys("uploadFiles"), "uploadFiles", (a, b, c) => { | ||
for (const File of b[0].uploads) { | ||
const NoNoFileName = this.generateRandomFilename(File.filename); | ||
File.filename = NoNoFileName; | ||
} | ||
}); | ||
} | ||
|
||
stop() { | ||
// this will never change but still | ||
this.Main?.(); | ||
} | ||
|
||
generateRandomFilename(originalFilename) { | ||
const splitStuff = originalFilename.split('.'); // something.exe -> ['something', 'exe'] | ||
const fileExt = splitStuff[splitStuff.length - 1] // hi there file ext. :) | ||
let randomFilename = ''; | ||
for (let i = 0; i < originalFilename.length; i++) { | ||
const randomIndex = Math.floor(Math.random() * characters.length); | ||
randomFilename += characters.charAt(randomIndex); | ||
} | ||
return `${randomFilename}.${fileExt}` | ||
} | ||
} |