|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
const prisma = require("../clients/prisma");
|
|
|
|
|
|
|
|
|
|
const command = {
|
|
|
|
|
name: "join",
|
|
|
|
|
desc: "make the bot listen to a channel",
|
|
|
|
@ -18,6 +20,21 @@ const command = {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const storeChannel = await prisma.channel.create({
|
|
|
|
|
data: {
|
|
|
|
|
name: msg.senderUsername,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!storeChannel) {
|
|
|
|
|
await client.say(
|
|
|
|
|
msg.channelName,
|
|
|
|
|
`${msg.displayName}, something went wrong saving`
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await client
|
|
|
|
|
.join(msg.senderUsername)
|
|
|
|
|
.then(
|
|
|
|
@ -26,14 +43,14 @@ const command = {
|
|
|
|
|
msg.channelName,
|
|
|
|
|
`${msg.displayName}, joined ${msg.senderUsername} BroBalt`
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.then(() => client.say(msg.senderUsername, "MrDestructoid"))
|
|
|
|
|
.catch(
|
|
|
|
|
async () =>
|
|
|
|
|
await client.say(
|
|
|
|
|
msg.channelName,
|
|
|
|
|
`${msg.displayName}, the bot is probably in your chat, but can't speak because of phone number etc verification`
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await client
|
|
|
|
|
.say(msg.senderUsername, "MrDestructoid")
|
|
|
|
|
.catch((err) =>
|
|
|
|
|
console.error(
|
|
|
|
|
`The bot can't speak in the newly joined channel! Error: ${err.message}`
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|