style: refactor logic
This commit is contained in:
@@ -36,26 +36,18 @@ class TTSListener implements Command {
|
||||
};
|
||||
|
||||
messageListener = async (msg: Message): Promise<void> => {
|
||||
if (msg.content.length === 0) return;
|
||||
if (!msg.content || !msg.guild || !msg.member?.voice) return;
|
||||
|
||||
const voiceConnection = getVoiceConnection(msg.guildId!);
|
||||
if (voiceConnection?.state.status !== VoiceConnectionStatus.Ready) return;
|
||||
|
||||
const guild = msg.guild;
|
||||
if (!guild) return;
|
||||
|
||||
const me = guild.members.me;
|
||||
if (!me || !me.voice) return;
|
||||
|
||||
const member = msg.member;
|
||||
if (!member || !member.voice) return;
|
||||
|
||||
if (!me) return;
|
||||
if (member.voice.channelId !== me.voice.channelId) return;
|
||||
|
||||
const voiceConnection = getVoiceConnection(guild.id);
|
||||
if (
|
||||
!voiceConnection ||
|
||||
voiceConnection.state.status !== VoiceConnectionStatus.Ready
|
||||
)
|
||||
return;
|
||||
|
||||
const db = await DatabaseManager.get;
|
||||
|
||||
const guildData = await db.getGuild(guild.id);
|
||||
|
||||
Reference in New Issue
Block a user