Skip to content

Commit

Permalink
♻️ speak refactored bt sonny & ✨ AliMoji
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvdev committed Jul 16, 2024
1 parent efaae2f commit 2a59c64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/commands/speak.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,25 @@ function reset({ userName }) {
}

function speak(message) {
// los uqe votaron que no, la tienen adentro - Sonny - 8/7/2024
const { msg, userName } = message

if (ttsEnabled) {
let accent = ttsAccent
let variant = ttsIndex || 1
let toRead = ''
const words = msg.split(' ').map((word) => word.trim())
if (isAnAccent(words[ACCENT_OR_MODIFIER])) {
accent = normalize(words[ACCENT_OR_MODIFIER])
if (!Number.isNaN(Number(words[VARIANT]))) {
variant = Number(words[VARIANT])
toRead = words.slice(VARIANT + 1).join(' ')
} else toRead = words.slice(ACCENT_OR_MODIFIER + 1).join(' ')
} else {
toRead = msg.replace('!speak ', '')
const config = ttsConfigVault.getConfig(userName)
if (config) {
accent = config.accent
variant = config.variant
const config = ttsConfigVault.getConfig(userName)
let accent = config ? config.accent : ttsAccent
let variant = config ? config.variant : ttsIndex || 1
const words = msg
.replace('!speak ', '')
.split(' ')
.map((word) => word.trim())
if (isAnAccent(words[0])) {
accent = normalize(String(words.splice(0, 1)))
if (!Number.isNaN(Number(words[0]))) {
variant = Number(words.splice(0, 1))
}
}
message.speak = {
toRead: toRead.trim(),
toRead: words.join(' ').trim().replaceAll(':3', 'AliMoyi'),
accent,
variant
}
Expand Down
3 changes: 3 additions & 0 deletions src/middlewares/place_hearts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ export default function placeHearts(message) {
message.emotes = { ...message.emotes, ...afordiLove }
} else message.emotes = afordiLove
}
if (message.msg?.includes(':3')) {
message.msg = message.msg.replaceAll(':3', '😺')
}
return message
}

0 comments on commit 2a59c64

Please sign in to comment.