various fixes and refactorings
This commit is contained in:
parent
5a2dce2773
commit
d8c2513954
29
.eslintrc.js
29
.eslintrc.js
|
@ -1,21 +1,14 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es2021": true
|
||||
env: {
|
||||
node: true,
|
||||
commonjs: true,
|
||||
es2021: true,
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"overrides": [
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest"
|
||||
extends: ["eslint:recommended", "plugin:react/recommended"],
|
||||
overrides: [],
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
},
|
||||
"plugins": [
|
||||
"react"
|
||||
],
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
plugins: ["react"],
|
||||
rules: {},
|
||||
};
|
||||
|
|
|
@ -20,13 +20,17 @@ client.commands = getCommands();
|
|||
console.log("Commands loaded");
|
||||
|
||||
client.on("ready", async () => {
|
||||
console.log("connected to chat");
|
||||
const channels = await prisma.channel.findMany();
|
||||
console.log("Connected to chat");
|
||||
|
||||
console.log("Joining bots channel: " + process.env.TWITCH_USERNAME);
|
||||
client.join(process.env.TWITCH_USERNAME);
|
||||
|
||||
const channels = await prisma.channel.findMany();
|
||||
for (let channel of channels) {
|
||||
console.log("Joining channel: " + channel.name);
|
||||
client.join(channel.name);
|
||||
}
|
||||
|
||||
console.log("Joined channels");
|
||||
});
|
||||
|
||||
|
@ -48,7 +52,7 @@ client.on("PRIVMSG", async (msg) => {
|
|||
|
||||
if (splitted[0] === process.env.BOT_PREFIX) {
|
||||
try {
|
||||
if (!client.commands.hasOwnProperty(splitted[1])) {
|
||||
if (!(splitted[1] in client.commands)) {
|
||||
await client.say(msg.channelName, `${msg.displayName}, not a command`);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ const command = {
|
|||
mod: false,
|
||||
run: async (client, msg, splitted) => {
|
||||
const data = await fetch(
|
||||
`https://librex.nekus.gay/api.php?q="${encodeURIComponent(
|
||||
`https://search.femboy.hu/api.php?q="${encodeURIComponent(
|
||||
splitted.slice(2).join(" ")
|
||||
)}"`
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ const command = {
|
|||
`${msg.displayName}, First result for query ${splitted
|
||||
.slice(2)
|
||||
.join(" ")}: ${
|
||||
data.hasOwnProperty("special_response")
|
||||
"special_response" in data
|
||||
? `${data.special_response.response.replaceAll("\n", "")} - ${
|
||||
data.special_response.source
|
||||
}`
|
||||
|
|
|
@ -6,6 +6,14 @@ const command = {
|
|||
restricted: false,
|
||||
mod: false,
|
||||
run: async (client, msg) => {
|
||||
if (msg.channelName !== process.env.TWITCH_USERNAME) {
|
||||
await client.say(
|
||||
msg.channelName,
|
||||
`${msg.displayName}, command only available in bot chat`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.joinedChannels.has(msg.senderUsername)) {
|
||||
await client.say(
|
||||
msg.channelName,
|
||||
|
|
Loading…
Reference in New Issue