Skip to content

Commit

Permalink
Allow Replies (fixes #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese committed Sep 24, 2022
1 parent 3209f25 commit 99f54b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { FormTitle, Card, Text, Button } = require('powercord/components')
const { sendMessage } = getModule([ 'sendMessage' ], false)
const { ComponentDispatch } = getModule([ 'ComponentDispatch' ], false)

module.exports = ({ slowmode, channel, message }) =>
module.exports = ({ slowmode, channel, message, other = undefined, reply }) =>
<Modal size={ Modal.Sizes.SMALL }>
<Modal.Header>
<FormTitle tag="h3">WARNING!</FormTitle>
Expand All @@ -22,7 +22,7 @@ module.exports = ({ slowmode, channel, message }) =>
style={{ marginRight: '10px' }}
onClick={ () => {
closeModal();
sendMessage(channel, { ...message, __DNSM_afterWarn: true })
sendMessage(channel, { ...message, __DNSM_afterWarn: true }, other, reply)
}}
color={ Button.Colors.RED }>
Send Message Anyway
Expand Down
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ module.exports = class doNotSlowmode extends Plugin {
let parsedPermissions = this.parseBitFieldPermissions(permissions);

// There is no need to show a notice if the user has perms that bypass the slowmode
if (parsedPermissions['MANAGE_MESSAGES'] || parsedPermissions['MANAGE_CHANNELS']) return args;
//if (parsedPermissions['MANAGE_MESSAGES'] || parsedPermissions['MANAGE_CHANNELS']) return args;


if (this.cooldownTime() < this.settings.get('slowmodeTrigger', '600')) return args;
console.log(args)

if (!args[1]?.__DNSM_afterWarn) {
open(() => React.createElement(Modal, {
slowmode: this.cooldownTime(),
channel: channels.getChannelId(),
message: args[1]
message: args[1],
other: args[2],
reply: args[3]
}));
return false;
}
Expand Down

0 comments on commit 99f54b9

Please sign in to comment.