Skip to content

Commit

Permalink
Merge pull request #5 from CaptainM777/fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
CaptainM777 authored Jul 25, 2024
2 parents 3c0e626 + e66a7e3 commit e98b3b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/modules/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ module.exports = ({ bot, knex, config, commands }) => {
? moment.utc().add(args.blockTime, "ms").format("YYYY-MM-DD HH:mm:ss")
: null;

const user = bot.users.get(userIdToBlock);
let user = bot.users.get(userIdToBlock);

if (! user) {
try {
console.log(`Getting data for user ${userIdToBlock} from the REST API...`);
user = await bot.getRESTUser(userIdToBlock);
} catch (e) {
console.log(e);
channel.createMessage(`Unable to block user due to an internal error.`);
return;
}
}

await blocked.block(userIdToBlock, (user ? user.username : ""), msg.author.id, expiresAt);

if (expiresAt) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = ({ bot, knex, config, commands, hooks }) => {
const formattedLogUrl = logUrl
? `<${addOptQueryStringToUrl(logUrl, args)}>`
: `View log with \`${config.prefix}log ${userThread.thread_number}\``
const formattedDate = moment.utc(userThread.created_at).format("MMM Do [at] HH:mm [UTC]");
const formattedDate = moment.utc(userThread.created_at).format("MMM Do YYYY [at] HH:mm [UTC]");
return `\`#${userThread.thread_number}\` \`${formattedDate}\`: ${formattedLogUrl}`;
}));

Expand Down
2 changes: 1 addition & 1 deletion src/modules/typingProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = ({ bot }) => {
}

// config.typingProxy: forward user typing in a DM to the modmail thread
if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
if (config.typingProxy && !channel.guild) {
const thread = await threads.findOpenThreadByUserId(user.id);
if (! thread) return;

Expand Down

0 comments on commit e98b3b2

Please sign in to comment.