Skip to content

Commit

Permalink
BETA VERSION 0.68.2 (#1859)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mittelblut9 authored Jan 20, 2024
2 parents 7aa3ce2 + 52f0b75 commit 0017f87
Show file tree
Hide file tree
Showing 30 changed files with 149 additions and 267 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
- name: Build
run: |
NODE_ENV=production docker compose down && docker compose up -d
export NODE_ENV=production
docker compose down && docker compose up -d
- name: Wait 60 seconds and check if all containers are healthy
run: |
Expand Down
5 changes: 3 additions & 2 deletions bot/events/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ module.exports.guildMemberAdd = async (member, bot) => {
if (joinroles.length === 0) return;

for (let i in joinroles) {
const joinrole = await member.guild.roles.cache.find((r) => r.id === joinroles[i]);
await member.roles.add(joinrole).catch((err) => {});
const joinrole = joinroles[i];
const guildRole = await member.guild.roles.cache.find((r) => r.id === joinrole);
await member.roles.add(guildRole).catch(() => {});
}
errorhandler({
fatal: false,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
- 5000:5000
command: >
sh -c 'if [ "$NODE_ENV" = "development" ]; then
npm install -g nodemon && npm install && npm run alias-build && ls -la /app/bot/core && node ./bot/core/shard.js
npm install -g nodemon && npm install && npm run alias-build && ls -la /app/bot/core && nodemon ./bot/core/shard.js
else
npm install --omit=dev && npm run alias-build && node bot/core/shard.js
fi'
Expand Down
6 changes: 3 additions & 3 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"~utils/*": ["./utils/*"],
"~bot/*": ["./bot/*"],
"~core/*": ["./bot/core/*"],
"~assets/*": ["./src/assets/*"]
}
"~assets/*": ["./src/assets/*"],
},
},
"exclude": ["node_modules"]
"exclude": ["node_modules"],
}
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mittelbot",
"version": "0.68.1",
"version": "0.68.2",
"description": "A Discord Bot written in Node.js",
"main": "bot/core/shard.js",
"private": true,
Expand All @@ -12,8 +12,8 @@
"stop": "docker compose down",
"restart": "npm run stop && npm run start:dev",
"log": "docker logs -f mittelbot",
"format": "npm run stop && docker run --rm -v $(pwd):/app -w /app node:18.8 sh -c \"npm install -g prettier && prettier --config .tools/prettier/.prettierrc --ignore-path .tools/prettier/.prettierignore --write .\"",
"check": "docker run --rm -v $(pwd):/app -w /app node:18.8 sh -c \"npm install -g prettier && prettier --config .tools/prettier/.prettierrc --ignore-path .tools/prettier/.prettierignore --check .\"",
"format": "prettier --config .tools/prettier/.prettierrc --ignore-path .tools/prettier/.prettierignore --write .",
"check": "prettier --config .tools/prettier/.prettierrc --ignore-path .tools/prettier/.prettierignore --check .",
"postinstall": "patch-package && husky install",
"alias-build": "link-module-alias",
"test": "jest --forceExit",
Expand Down Expand Up @@ -70,14 +70,14 @@
"dotenv": "^16.3.1",
"extends-classes": "^1.0.5",
"ffmpeg-static": "^5.2.0",
"googleapis": "^130.0.0",
"googleapis": "^131.0.0",
"husky": "^8.0.3",
"imgur": "^2.3.0",
"jsonwebtoken": "^9.0.2",
"link-module-alias": "^1.2.0",
"module-alias": "^2.2.3",
"moment-timezone": "^0.5.44",
"mysql2": "^3.7.0",
"mysql2": "^3.7.1",
"nconf": "^0.12.1",
"patch-package": "^8.0.0",
"random-animals-api": "^1.2.6",
Expand All @@ -95,7 +95,7 @@
"@lambocreeper/mock-discord.js": "^3.0.0",
"jest": "^29.7.0",
"node-sloc": "^0.2.1",
"nodemon": "^3.0.2",
"prettier": "^3.2.2"
"nodemon": "^3.0.3",
"prettier": "^3.2.4"
}
}
4 changes: 0 additions & 4 deletions src/db/Models/guildUploads.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ GuildUploads.init(
type: DataTypes.BIGINT,
defaultValue: 0,
},
views: {
type: DataTypes.BIGINT,
defaultValue: 0,
},
subs: {
type: DataTypes.BIGINT,
defaultValue: 0,
Expand Down
4 changes: 0 additions & 4 deletions src/db/Models/twitchStreams.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ TwitchStreams.init(
embedUpdatedAt: {
type: DataTypes.DATE,
},
views: {
type: DataTypes.BIGINT,
defaultValue: 0,
},
},
{
sequelize: database,
Expand Down
49 changes: 26 additions & 23 deletions src/events/checkInfraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,59 @@ module.exports.checkInfractions = (bot) => {
let mutecount = 0;
let bancount = 0;
for (let i in results) {
if (results[i].till_date == null) continue;
const till_dateDB = results[i].till_date;

if (till_dateDB == null) continue;

const currentdate = new Date().getTime();
const till_date = results[i].till_date.getTime();
const till_date = till_dateDB.getTime();

const currentYear = new Date().getFullYear();
const infYear = results[i].till_date.getFullYear();
if (currentdate - till_date >= 0 && currentYear <= infYear) {
const guild = await bot.guilds.cache.get(results[i].guild_id);
const guildId = results[i].guild_id;
const guild = await bot.guilds.cache.get(guildId);
const isMute = results[i].mute;

if (results[i].mute) {
if (isMute) {
const userId = results[i].user_id;
const user = await guild.members
.fetch(results[i].user_id)
.fetch(userId)
.then((members) => {
return members;
})
.catch(async () => {
return await bot.users.cache.get(results[i].user_id);
return await bot.users.cache.get(userId);
});
try {
const userRoles = results[i].user_roles;
await removeMutedRole(user, guild);

if (user) {
await giveAllRoles(
results[i].user_id,
guild,
results[i].user_roles,
bot
);
await giveAllRoles(userId, guild, userRoles, bot);
}

await saveAllRoles(results[i].user_roles || null, user, guild);
await saveAllRoles(userRoles || null, user, guild);

await setNewModLogMessage(
bot,
config.defaultModTypes.unmute,
bot.user.id,
user ? user.id : results[i].user_id,
user ? user.id : userId,
'Auto',
null,
results[i].guild_id
guildId
);

await privateModResponse({
member: user ? user.id : results[i].user_id,
member: user ? user.id : userId,
type: config.defaultModTypes.unmute,
reason: 'Auto',
bot,
guildname: guild.name,
});

await new Infractions().moveFromOpenToClosed(results[i]);
const result = results[i];
await new Infractions().moveFromOpenToClosed(result);
} catch (err) {
errorhandler({ err });
}
Expand All @@ -78,31 +79,33 @@ module.exports.checkInfractions = (bot) => {
mutecount++;
continue;
} else {
const userId = results[i].user_id;
const guildId = results[i].guild_id;
//Member got banned
await new Infractions().moveFromOpenToClosed(results[i]);
await guild.members
.unban(`${results[i].user_id}`, `Auto`)
.unban(`${userId}`, `Auto`)
.then(async () => {
await setNewModLogMessage(
bot,
config.defaultModTypes.unban,
bot.user.id,
results[i].user_id,
userId,
'Auto',
null,
results[i].guild_id
guildId
);

await privateModResponse(
bot.users.cache.get(results[i].user_id),
bot.users.cache.get(userId),
config.defaultModTypes.unmute,
'Auto',
null,
bot,
guild.name
);
})
.catch((err) => {});
.catch(() => {});

done++;
bancount++;
Expand Down
1 change: 0 additions & 1 deletion src/events/notfifier/reddit_notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports.reddit_notifier = async (bot) => {
const {
title,
url,
hidden,
selftext,
over_18,
permalink,
Expand Down
6 changes: 3 additions & 3 deletions src/events/timer/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ module.exports.timer = async (bot) => {
channel.guild.id
),
})
.catch((err) => {});
.catch(() => {});
})
.catch((err) => {
.catch(() => {
message.react('❌');
});
await timer.destroy(channel.guild.id).catch((err) => {});
await timer.destroy(channel.guild.id).catch(() => {});
return;
}

Expand Down
Loading

0 comments on commit 0017f87

Please sign in to comment.