Compare commits

...

146 commits

Author SHA1 Message Date
byeoon
9bf08a3ebf
Merge 4f6e980dc4 into b875ebf92d 2024-09-19 14:59:13 +02:00
Nuckyz
b875ebf92d
UserVoiceShow: Fix setting name
Some checks are pending
Sync to Codeberg / codeberg (push) Waiting to run
test / test (push) Waiting to run
2024-09-19 08:48:56 -03:00
Vendicated
c7e5295da0
SearchReply => FullSearchContext ~ now adds all options back
Some checks are pending
Sync to Codeberg / codeberg (push) Waiting to run
test / test (push) Waiting to run
2024-09-18 21:33:46 +02:00
byeoon
4f6e980dc4
Merge branch 'dev' into main 2024-08-29 18:53:26 -04:00
byeoon
e7faf3321e
Merge branch 'dev' into main 2024-08-17 12:30:20 -04:00
byeoon
187ca435b5
Merge branch 'dev' into main 2024-07-13 10:00:46 -04:00
byeoon
a3d4c1963f
Merge branch 'dev' into main 2024-07-10 10:12:39 -04:00
byron
cb4be3d77b wtf lint 2024-07-04 01:18:43 -04:00
byeoon
ae6290a605
Merge branch 'dev' into main 2024-07-04 01:12:59 -04:00
byron
0561b3890a fix thing no work 2024-06-21 21:16:05 -04:00
byron
ec4e97b187 might fully work now!! 2024-06-21 21:12:59 -04:00
byeoon
3b20759c60
Merge branch 'dev' into main 2024-06-21 20:31:17 -04:00
byron
5e52a34205 hewlp vinneie vnecord no work 2024-06-21 20:31:05 -04:00
byron
2cd661f7b6 YAY this should work!! 2024-06-21 20:11:30 -04:00
byeoon
e88e3b3e13
Merge branch 'dev' into main 2024-06-15 19:00:08 -04:00
byron
db4c0d1446 test 2024-06-12 17:32:49 -04:00
byeoon
1de442a84b
Merge branch 'dev' into main 2024-06-12 09:47:56 -04:00
byeoon
c93f694faf
found switch / checkbox element 2024-06-11 09:08:15 -04:00
byron
f045554bfe yay its undefined for some reason 2024-06-10 16:51:25 -04:00
byron
5180df743b todo: add finishing touches and fix bugs because webhooks arent sending rn 2024-06-10 16:46:10 -04:00
byron
f84220eada feat: modal!! (still wip) 2024-06-10 16:35:08 -04:00
byeoon
588a40c43f
fuck lint. 2024-06-10 13:53:58 -04:00
byeoon
56be5eb247
i swear to god if this doesnt fix it 2024-06-10 13:53:06 -04:00
byeoon
9ad6e1b3a2
??????? 2024-06-10 13:51:19 -04:00
byeoon
c0842cb84c
forgot imports! 2024-06-10 13:49:57 -04:00
byeoon
fc3618628f
fix: lint and code error with modal template 2024-06-10 13:48:41 -04:00
byeoon
2721cd3d47
fix lint breaking 2024-06-10 09:49:48 -04:00
byeoon
1da50eb8f4
todo: add modal 2024-06-10 09:47:50 -04:00
byeoon
8696ca0706
fix: small bug with webhook execution & added vee to devs because they helped a lot (tysm) 2024-06-10 09:37:37 -04:00
byeoon
070b25e813
Merge branch 'dev' into main 2024-06-10 09:32:33 -04:00
byron
90c9dd20bb change name in constants 2024-06-07 22:27:39 -04:00
byron
dcb9402f1c Merge branch 'main' of https://github.com/byeoon/Vencord 2024-06-07 22:25:56 -04:00
byron
bc3093a41e removed tts thing because i think most people have tts muted anyways and also too much to add also small fixes 2024-06-07 22:25:55 -04:00
byeoon
6c19f52f26
Merge branch 'dev' into main 2024-06-07 22:21:32 -04:00
byeoon
b63becffb6
Merge branch 'dev' into main 2024-06-07 22:21:25 -04:00
byeoon
7a1a9d20e8
Merge branch 'dev' into main 2024-06-07 22:20:24 -04:00
Vendicated
ae10deaee4
fix 2024-06-08 03:41:45 +02:00
Vendicated
61eacb2106
fix folder name part 2 2024-06-08 03:38:31 +02:00
Vendicated
b3a9d33411
clean up 2024-06-08 03:38:09 +02:00
byeoon
e764018621
Merge branch 'dev' into main 2024-06-07 21:30:49 -04:00
Vendicated
cafe4b19a2
fix folder name 2024-06-08 03:29:39 +02:00
byeoon
422c18c37c
Merge branch 'dev' into main 2024-06-07 16:04:41 -04:00
byeoon
d7036c5886
shorter lines
Co-authored-by: vee <vendicated@riseup.net>
2024-06-07 16:02:24 -04:00
byeoon
9ee1b5ba6e
Update src/plugins/WebhookManager/index.tsx
Co-authored-by: vee <vendicated@riseup.net>
2024-06-07 16:01:46 -04:00
byeoon
0d4ec94203
Merge branch 'dev' into main 2024-06-06 08:33:29 -04:00
byeoon
0df09f2aab
blep small fix
Co-authored-by: vee <vendicated@riseup.net>
2024-06-06 08:33:15 -04:00
byeoon
2728102fbc
Merge branch 'dev' into main 2024-06-05 23:15:31 -04:00
byeoon
249ea30995
holy shit since when coild READMEs look this good
Co-authored-by: vee <vendicated@riseup.net>
2024-06-05 23:10:29 -04:00
byeoon
8d2fa0e45f
Merge branch 'dev' into main 2024-05-31 09:13:30 -04:00
byeoon
adc60648a5
Merge branch 'dev' into main 2024-05-30 09:34:31 -04:00
Nuckyz
9a9c1b0487
Reporter: Properly implement reporter build of Vencord; Test more plugins; Fix running in wrong pages 2024-05-30 04:44:13 -03:00
Nuckyz
892de53603
Fix extractAndLoadChunks issue with 2 match groups; Improve testing of lazy extractAndLoadChunks 2024-05-30 00:51:23 -03:00
Nuckyz
c8602ef52b
Fix reporter breaking because of ConsoleShortcuts 2024-05-29 06:45:44 -03:00
byeoon
c88ac8d5ca
Merge branch 'dev' into main 2024-05-28 23:36:24 -04:00
byeoon
de2598a87a
Merge branch 'dev' into main 2024-05-24 12:32:42 -04:00
byeoon
c3af902ace
Merge branch 'dev' into main 2024-05-21 09:27:10 -04:00
byron
e04225df1a Merge branch 'main' of https://github.com/byeoon/Vencord 2024-05-20 17:36:50 -04:00
byeoon
dec282bf50
Merge branch 'dev' into main 2024-05-20 15:57:31 -04:00
byron
d29d5e9476 revert error change 2024-05-20 15:53:56 -04:00
byeoon
46e4fc664a
oopsie 2024-05-15 09:49:32 -04:00
byeoon
e9cb2eccec
Merge branch 'dev' into main 2024-05-15 09:47:42 -04:00
byeoon
f0483f9c24
why cant i remove the stores.ts conflict 2024-05-15 09:46:10 -04:00
byeoon
13119c0b29
extra error handling - will add more later 2024-05-15 09:43:30 -04:00
byeoon
720aaf6f3e
Merge branch 'dev' into main 2024-05-07 07:53:47 -04:00
Nuckyz
f04bd8a7ad
useStateFromStores: Document 3rd param and fix JSDoc 2024-05-07 06:13:38 -03:00
byeoon
acf77127c8
Merge branch 'dev' into main 2024-05-03 20:26:51 -04:00
byeoon
530e19e266
Merge branch 'dev' into main 2024-05-02 10:39:41 -04:00
byron
7f36d8569f fixed lint 2024-05-01 18:07:11 -04:00
byron
28f70e2942 fix embed color not being blue, fix webhook profile picture not appearing, fix deleting webhooks not working, general code and QoL improvements 2024-05-01 18:02:14 -04:00
byeoon
6d704d603e
Merge branch 'dev' into main 2024-05-01 16:52:23 -04:00
byeoon
65787848c4
Merge branch 'dev' into main 2024-04-22 13:03:05 -04:00
byeoon
73ca8dc776
Merge branch 'Vendicated:main' into main 2024-04-17 14:39:24 -04:00
byron
209c64afc4
Merge branch 'dev' into main 2024-04-09 18:47:50 -04:00
byron
b4366bdab6
small code refactors and changes to text 2024-04-09 12:32:53 -04:00
byron
70ae9eabf4
Merge branch 'dev' into main 2024-04-09 12:24:51 -04:00
byron
d739675413
Merge branch 'dev' into main 2024-04-08 22:01:57 -04:00
byron
2462544d61
Merge branch 'dev' into main 2024-04-08 21:20:29 -04:00
byron
6022317d5e
Merge pull request #1 from byeoon/fixEmoteCloneQuality 2024-04-08 21:16:35 -04:00
byron
8f0204b4ca
Discard changes to src/utils/constants.ts 2024-04-08 21:13:57 -04:00
byron
f801ab3cb9
Discard changes to src/plugins/emoteCloner/index.tsx 2024-04-08 21:13:50 -04:00
byron
8c48731026 this shit is confusing me 2024-04-08 21:06:20 -04:00
byron
31993c0053 oops readme was broken fixed it again 2024-04-08 21:05:26 -04:00
byron
1dc98721ee Instead of logging to console when there's an error, log it to the webhook message, also fixes to the README 2024-04-08 20:52:50 -04:00
V
6266d037e7
Merge branch 'dev' into fixEmoteCloneQuality 2024-04-09 02:30:29 +02:00
V
4c466e9c04
Update index.tsx 2024-04-09 02:29:58 +02:00
V
522d2fd35c
lossless 2024-04-09 02:29:20 +02:00
byron
e24d5d3f93
Update src/plugins/emoteCloner/index.tsx
Co-authored-by: ryan-0324 <77452312+ryan-0324@users.noreply.github.com>
2024-04-03 18:39:46 -04:00
byron
521647b4e1 merged into above statement 2024-04-03 17:32:17 -04:00
byron
23992bd213 fixed an issue where external emotes would count towards the max emote limit 2024-04-03 17:20:37 -04:00
byron
bc64dd400a fixed a bug where external emotes counted towards the limit (twitch) 2024-04-03 17:19:00 -04:00
byron
38647087e0
update to actual highest quality
Co-authored-by: Nam Anh <phamnamanh25@gmail.com>
2024-04-02 07:28:15 -04:00
byron
c5d03bab3b oopsie idk why i added words there 2024-03-31 23:20:51 -04:00
byron
abf48db04d (fix)Fixed a bug where EmoteCloner would clone stickers at the lowest resolution (now defaults to 2048) 2024-03-31 23:15:28 -04:00
byron
2c11a7ad84 Set the default sticker size to 2048 to prevent downscaling, also, time to put this into a second branch 2024-03-31 23:04:32 -04:00
byron
570e41b95c bruh moment i should probably change forks 2024-03-31 22:43:46 -04:00
byron
b722513662 add debug to check sticker output 2024-03-31 22:40:16 -04:00
byron
e608170820
Merge branch 'main' into main 2024-03-29 21:24:58 -04:00
byron
082227301e
Merge branch 'main' into main 2024-03-28 23:45:23 -04:00
byron
f87c73685e
Merge branch 'main' into main 2024-03-28 02:03:13 -04:00
byron
04c4c85ea7
Merge branch 'main' into main 2024-03-28 01:27:36 -04:00
byron
82cc75ecc8
Merge branch 'main' into main 2024-03-27 23:14:12 -04:00
byron
39b3e747f9
also updating dev label to be on proper account 2024-03-27 00:17:31 -04:00
byron
83fedd4df1
remove empty lines 2024-03-27 00:16:41 -04:00
byron
9edb4c01f2
test 2024-03-22 10:06:57 -04:00
Nuckyz
c542a81986
Merge branch 'main' into main 2024-03-22 10:47:34 -03:00
byron
1d93a03654
revert 2024-03-22 09:40:42 -04:00
byron
1a106e755b
TEMP DOING THIS JUST TO FIX BRANCH ISSUE 2024-03-22 09:39:01 -04:00
byron
c2a8671f31 linting and testing all over the place 2024-03-21 18:35:04 -04:00
byron
3ec9f7cf89 test push that hopefully fixes something 2024-03-21 18:32:35 -04:00
byron
7c71d9f52d added url validation 2024-03-21 17:27:57 -04:00
byron
2ac335c3f4
handle if there is no profile pic option, also making it string only because compatibility issues 2024-03-18 11:28:08 -04:00
byron
1947cedd55 oops forgot to add back the if statement 2024-03-15 21:31:05 -04:00
byron
610c48fe92 hope this adds attachment support, if not i may need help 2024-03-15 21:25:15 -04:00
byron
736fef879e removed unneeded / unreachable code, changed 'rawjson' to just 'raw', working on attachment sending as well 2024-03-15 21:18:53 -04:00
byron
8a09cb533b Could simplify this to one variable instead 2024-03-15 21:00:40 -04:00
byron
9c7c3d0c5d fixed that god-awful annoying bug where you couldnt use the default webhook name 2024-03-15 18:44:30 -04:00
byron
f43f404123
put the pingable text into 'content' and not the embed, also added the ability to get the userID for simplicity 2024-03-14 11:03:54 -04:00
byron
73a2f5548a now* it's ready 2024-03-13 18:03:31 -04:00
byron
2da6a64748 Ready for reviews / feedback 2024-03-13 18:02:42 -04:00
byron
9fab41449a Added extra information for 'Type 2' Webhooks (Server Following / Announcements), more small tweaks to the embed 2024-03-13 17:46:28 -04:00
byron
1225861843 Fixed bug that was caused when doing /webhook info, also updated the embed style and looks better 2024-03-13 17:28:58 -04:00
byron
9b600b9dad
*quickly changed some grammar* 2024-03-13 13:57:14 -04:00
byron
6df510d9f5
Added title to embed, fixed accidental leftover symbols 2024-03-13 13:20:48 -04:00
byron
a6c7cb9517
Also added the ability to send webhooks with TTS (For the sillies and goofs) 2024-03-13 13:07:51 -04:00
byron
4cb2661ae9
Also fixed the commands to be better 2024-03-13 12:52:25 -04:00
byron
0fd7a59d8a
literal string for webhookinfo, also inside of an embed, better way to format the icon instead of clicking now. 2024-03-13 12:47:22 -04:00
byron
f2b22bc349
Removed notes, fully moved logging to Logger, fixed everything back to const (thank you) 2024-03-13 12:15:39 -04:00
byron
2f1c10de3e
me when im at school and bored and decide to keep on making improvements :trolley: 2024-03-13 11:03:52 -04:00
byron
1c3e33dbbd
Logger for error handling instead of console.log 2024-03-13 09:18:16 -04:00
byron
9060352977
re-discarded changes to .gitignore (sorry) 2024-03-12 22:36:55 -04:00
byron
4ea2d1ca5c
Fixed a ton of things, thank you suggestions and code reviews 2024-03-12 22:34:10 -04:00
V
284a951353
Discard changes to .gitignore 2024-03-13 03:23:51 +01:00
byron
d02a241ff9 (also fixed small bug where creator username would be undefined) 2024-03-12 21:49:36 -04:00
byron
cedf10bdd2 removed personal plugin i use before pull request (its in .gitignore i think) also added logging to console on getinfo 2024-03-12 21:47:15 -04:00
byron
4f68631080 Finally did it, fixed the sending bug 2024-03-12 21:45:52 -04:00
byron
278c4f0d60 Plugin now crashes, but im pushing to see if i accidnetally messed with another file 2024-03-12 19:38:34 -04:00
byron
ba0a9d0696 Fixed issues with plugin not loading, and fixed bugs 2024-03-12 14:56:40 -04:00
byron
f41c6f4762
Learned that I'm supposed to actually put the plugins in /plugins and not /userplugins, moved plugin into correct directory and fixed the .gitignore 2024-03-12 13:53:41 -04:00
byron
87e86271fe
Forgot to add error to console, removed dumb note I added in badge thing 2024-03-12 13:29:41 -04:00
byron
3dd65d520e
/webhookinfo has the ability to get a pingable version of the creator, webhook deletion now can determine if the URL is valid 2024-03-12 11:52:55 -04:00
byron
369f66e810
Added 'Creator Username' section for webhookinfo and adding text to speech on sending webhook message 2024-03-12 10:24:23 -04:00
byron
0207b9fa12
[style]fix missing line 2024-03-12 08:55:10 -04:00
byron
2c20a85871 Webhook info works, deleting also works, sending is still a WIP. 2024-03-11 21:51:24 -04:00
byron
ff6f24b8c9 Fixed bugs with plugin, on pc now & i use other plugins so i put it in gitignore 2024-03-11 16:15:58 -04:00
byron
bde85e073a
added second command, also added to devs for simplicity not sure if i should YET tho 2024-03-11 12:55:39 -04:00
byron
ccce4952cc
create plugin, haven't tested yet but will soon 2024-03-11 12:43:10 -04:00
11 changed files with 319 additions and 89 deletions

View file

@ -0,0 +1,5 @@
# FullSearchContext
Makes the message context menu in message search results have all options you'd expect.
![](https://github.com/user-attachments/assets/472d1327-3935-44c7-b7c4-0978b5348550)

View file

@ -0,0 +1,82 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common";
import { Message } from "discord-types/general";
import type { MouseEvent } from "react";
const { useMessageMenu } = findByPropsLazy("useMessageMenu");
function MessageMenu({ message, channel, onHeightUpdate }) {
const canReport = message.author &&
!(message.author.id === UserStore.getCurrentUser().id || message.author.system);
return useMessageMenu({
navId: "message-actions",
ariaLabel: i18n.Messages.MESSAGE_UTILITIES_A11Y_LABEL,
message,
channel,
canReport,
onHeightUpdate,
onClose: () => ContextMenuApi.closeContextMenu(),
textSelection: "",
favoriteableType: null,
favoriteableId: null,
favoriteableName: null,
itemHref: void 0,
itemSrc: void 0,
itemSafeSrc: void 0,
itemTextContent: void 0,
});
}
migratePluginSettings("FullSearchContext", "SearchReply");
export default definePlugin({
name: "FullSearchContext",
description: "Makes the message context menu in message search results have all options you'd expect",
authors: [Devs.Ven, Devs.Aria],
patches: [{
find: "onClick:this.handleMessageClick,",
replacement: {
match: /this(?=\.handleContextMenu\(\i,\i\))/,
replace: "$self"
}
}],
handleContextMenu(event: MouseEvent, message: Message) {
const channel = ChannelStore.getChannel(message.channel_id);
if (!channel) return;
event.stopPropagation();
ContextMenuApi.openContextMenu(event, contextMenuProps =>
<MessageMenu
message={message}
channel={channel}
onHeightUpdate={contextMenuProps.onHeightUpdate}
/>
);
}
});

View file

@ -1,6 +0,0 @@
# SearchReply
Adds a reply button to search results.
![the plugin in action](https://github.com/Vendicated/Vencord/assets/45497981/07e741d3-0f97-4e5c-82b0-80712ecf2cbb)

View file

@ -1,75 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { ReplyIcon } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByCodeLazy } from "@webpack";
import { ChannelStore, i18n, Menu, PermissionsBits, PermissionStore, SelectedChannelStore } from "@webpack/common";
import { Message } from "discord-types/general";
const replyToMessage = findByCodeLazy(".TEXTAREA_FOCUS)", "showMentionToggle:");
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, { message }: { message: Message; }) => {
// make sure the message is in the selected channel
if (SelectedChannelStore.getChannelId() !== message.channel_id) return;
const channel = ChannelStore.getChannel(message?.channel_id);
if (!channel) return;
if (channel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return;
// dms and group chats
const dmGroup = findGroupChildrenByChildId("pin", children);
if (dmGroup && !dmGroup.some(child => child?.props?.id === "reply")) {
const pinIndex = dmGroup.findIndex(c => c?.props.id === "pin");
dmGroup.splice(pinIndex + 1, 0, (
<Menu.MenuItem
id="reply"
label={i18n.Messages.MESSAGE_ACTION_REPLY}
icon={ReplyIcon}
action={(e: React.MouseEvent) => replyToMessage(channel, message, e)}
/>
));
return;
}
// servers
const serverGroup = findGroupChildrenByChildId("mark-unread", children);
if (serverGroup && !serverGroup.some(child => child?.props?.id === "reply")) {
serverGroup.unshift((
<Menu.MenuItem
id="reply"
label={i18n.Messages.MESSAGE_ACTION_REPLY}
icon={ReplyIcon}
action={(e: React.MouseEvent) => replyToMessage(channel, message, e)}
/>
));
return;
}
};
export default definePlugin({
name: "SearchReply",
description: "Adds a reply button to search results",
authors: [Devs.Aria],
contextMenus: {
"message": messageContextMenuPatch
}
});

View file

@ -103,7 +103,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
<UserSummaryItem
users={users}
renderIcon={false}
max={7}
max={14}
size={18}
/>
</div>
@ -159,6 +159,7 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChanne
<Tooltip
text={<VoiceChannelTooltip channel={channel} />}
tooltipClassName={cl("tooltip-container")}
tooltipContentClassName={cl("tooltip-content")}
>
{props =>
isLocked ?

View file

@ -32,7 +32,7 @@ const settings = definePluginSettings({
default: true,
restartNeeded: true
},
showInVoiceMemberList: {
showInMemberList: {
type: OptionType.BOOLEAN,
description: "Show a user's Voice Channel indicator in the member and DMs list",
default: true,
@ -82,12 +82,12 @@ export default definePlugin({
match: /\.subtext,children:.+?}\)\]}\)(?=])/,
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
},
predicate: () => settings.store.showInVoiceMemberList
predicate: () => settings.store.showInMemberList
}
],
start() {
if (settings.store.showInVoiceMemberList) {
if (settings.store.showInMemberList) {
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
}
},

View file

@ -15,7 +15,13 @@
}
.vc-uvs-tooltip-container {
max-width: 200px;
max-width: 300px;
}
.vc-uvs-tooltip-content {
display: flex;
flex-direction: column;
gap: 6px;
}
.vc-uvs-guild-name {
@ -31,7 +37,5 @@
.vc-uvs-vc-members {
display: flex;
margin: 8px 0;
flex-direction: row;
gap: 6px;
}

View file

@ -0,0 +1,21 @@
# WebhookManager
Manage your webhooks easily; delete, send messages, get detailed info and more.
## Commands
- /webhook send - *Sends a message through a webhook.*
- /webhook delete - *Deletes any webhook that is specified.*
- /webhook info - *Gets advanced details on the webhook such as the name, profile pic, server and channel ID, and additionally, information on person who created it*
<details>
<summary>Full /webhookinfo Output</summary>
- Webhook Username
- Webhook ID
- Webhook Token
- Channel ID
- Server ID
- Webhook Profile Picture
- Webhook Type
- Creator Profile
</details>

View file

@ -0,0 +1,176 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
import { Devs } from "@utils/constants";
import { Margins } from "@utils/margins";
import { ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin, { PluginNative } from "@utils/types";
import { Button, Forms, React, Switch, TextInput, useState } from "@webpack/common";
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
let url, content, username, avatarUrl = "";
let jsonMode = false;
// TODO: add sending as raw
function WebhookMessageModal(props: ModalProps) {
const [params, setParams] = useState({ content: "", username: "", avatarUrl: "", url: "", jsonMode: false });
const onURL = (url: string) => setParams(prev => ({ ...prev, url }));
const onContent = (content: string) => setParams(prev => ({ ...prev, content }));
const onUsername = (username: string) => setParams(prev => ({ ...prev, username }));
const onAvatar = (avatarUrl: string) => setParams(prev => ({ ...prev, avatarUrl }));
const onSwitch = (jsonMode: boolean) => setParams(prev => ({ ...prev, jsonMode }));
return <ModalRoot {...props} size={ModalSize.MEDIUM} className={"wm-send-webhook"} >
<ModalContent className="wm-send-webhook-content">
<Forms.FormTitle className={Margins.top20}>Webhook URL</Forms.FormTitle>
<TextInput
placeholder={"Webhook URL"}
value={params.url}
onChange={onURL}
/>
<Forms.FormTitle className={Margins.top20}>Webhook Message</Forms.FormTitle>
<TextInput
placeholder={"Content"}
value={params.content}
onChange={onContent}
/>
<Forms.FormTitle className={Margins.top20}>Webhook Username</Forms.FormTitle>
<TextInput
placeholder={"Username"}
value={params.username}
onChange={onUsername}
/>
<Forms.FormTitle className={Margins.top20}>Webhook Avatar URL</Forms.FormTitle>
<TextInput
placeholder={"Image URL"}
value={params.avatarUrl}
onChange={onAvatar}
/>
<Switch
key="wm-raw"
value={jsonMode}
onChange={onSwitch}
>Send as Raw JSON</Switch>
<Button
onClick={() => {
if (jsonMode !== true) {
Native.executeWebhook(params.url, {
content: params.content,
username: params.username,
avatar_url: params.avatarUrl
});
}
else {
Native.executeWebhook(params.url, {
webhookMessage: params.content,
username: params.username,
avatar_url: params.avatarUrl
});
}
}}
>Send Webhook</Button>
</ModalContent>
</ModalRoot >;
}
export default definePlugin({
name: "WebhookManager",
description: "Manage your webhooks easily; delete, send messages, get detailed info and more.",
authors: [Devs.Byeoon, Devs.Ven],
dependencies: ["CommandsAPI"],
commands: [
{
name: "webhook delete",
description: "Delete a webhook.",
inputType: ApplicationCommandInputType.BUILT_IN,
options: [
{
name: "url",
description: "The URL of the webhook",
type: ApplicationCommandOptionType.STRING,
required: true
}
],
execute: async (option, ctx) => {
try {
await fetch(findOption(option, "url", ""), {
method: "DELETE"
});
sendBotMessage(ctx.channel.id, {
content: "The webhook has deleted successfully."
});
}
catch (error) {
sendBotMessage(ctx.channel.id, {
content: "There was an error deleting the webhook. Did you input a valid webhook URL? Error: " + error
});
}
}
},
{
name: "webhook info",
description: "Retrieve information about a webhook.",
inputType: ApplicationCommandInputType.BUILT_IN,
options: [
{
name: "url",
description: "The URL of the webhook",
type: ApplicationCommandOptionType.STRING,
required: true
}
],
execute: async (option, ctx) => {
const webhookUrl = findOption(option, "url", "");
const { user, avatar, name, id, token, type, channel_id, guild_id }
= await fetch(webhookUrl).then(res => res.json());
sendBotMessage(ctx.channel.id, {
content: `This webhook was created by ${user?.name}.`,
embeds: [
{
title: "Webhook Information",
color: "1323",
// @ts-ignore
author: {
name,
url: ""
},
thumbnail: {
url: `https://cdn.discordapp.com/avatars/${id}/${avatar}.png`,
proxyURL: `https://cdn.discordapp.com/avatars/${id}/${avatar}.png`,
height: 128,
width: 128
},
description: `
Webhook ID: ${id}
Webhook Token: ${token}
Webhook Type: ${type}
Channel ID: ${channel_id}
Server ID: ${guild_id}
`
}
]
});
}
},
{
name: "webhook send",
description: "Send a message through a webhook.",
inputType: ApplicationCommandInputType.BUILT_IN,
async execute(_, ctx) {
openModal(props => <WebhookMessageModal {...props} />);
sendBotMessage(ctx.channel.id, {
content: "Your webhook message has been executed."
});
}
}
]
});

View file

@ -0,0 +1,22 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { IpcMainInvokeEvent } from "electron";
import https from "https";
const DiscordHosts = new Set(["discord.com", "ptb.discord.com", "canary.discord.com"]);
export function executeWebhook(_event: IpcMainInvokeEvent, url: string, body: object) {
const { hostname, pathname } = new URL(url);
if (!DiscordHosts.has(hostname) || !pathname.startsWith("/api/webhooks/")) {
throw new Error("This URL is not a valid webhook.");
}
const req = https.request(url, { method: "POST", headers: { "Content-Type": "application/json", } });
req.write(JSON.stringify(body));
req.end();
}

View file

@ -475,7 +475,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Sqaaakoi",
id: 259558259491340288n
},
Byron: {
Byeoon: {
name: "byeoon",
id: 1167275288036655133n
},