Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #5

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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