feat/40-reroll-on-disinterest #54
@ -10,7 +10,7 @@ export const name = 'messageReactionAdd'
|
||||
export async function execute(messageReaction: MessageReaction, user: User) {
|
||||
if (user.id == client.user?.id)
|
||||
logger.info('Skipping bot reaction')
|
||||
kenobi marked this conversation as resolved
Outdated
|
||||
const requestId = newRequestId
|
||||
const requestId = newRequestId()
|
||||
const guildId = messageReaction.message.inGuild() ? messageReaction.message.guildId : noGuildId
|
||||
const reactedUponMessage: Message = messageReaction.message.partial ? await messageReaction.message.fetch() : messageReaction.message
|
||||
if (!messageReaction.message.guild) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { createLogger, format, transports } from "winston"
|
||||
import { config } from "./configuration"
|
||||
import { v4 } from "uuid"
|
||||
export const newRequestId = v4()
|
||||
export function newRequestId() { return v4() }
|
||||
magnetotail marked this conversation as resolved
Outdated
magnetotail
commented
why? why?
kenobi
commented
This is a complete and total, boneheaded error :D This is a complete and total, boneheaded error :D
The _intention_ was to present an more memorizable way to get a new uuid/v4.
Instead this just sets it once, making it useless.
It _should_ be an exported function, returning the output of `v4()` and the callsite would be
`const requestId = newRequestId()`
This would prevent the
`import { v4 as uuid } from "uuid"` or `const requestId = v4()` which, I think, are tedious or non-obvious.
If you think this is a bad idea, I will gladly revert it though :)
magnetotail
commented
I dont think it's bad tbh if we dont need the v4 as uuid import then. But I would also like an eventhandler framework where we would prevent usual boilerplate code like looking for guild Id or making a request id and put those base checks and things in a base class and just have handling code in a subclass. But that is quite hard as I learned I dont think it's bad tbh if we dont need the v4 as uuid import then. But I would also like an eventhandler framework where we would prevent usual boilerplate code like looking for guild Id or making a request id and put those base checks and things in a base class and just have handling code in a subclass. But that is quite hard as I learned
|
||||
export const noGuildId = 'NoGuildId'
|
||||
|
||||
|
||||
|
need to return here
added