public async sendRpMessage(options: WebhookMessageCreateOptions, channel: GuildTextBasedChannel, char: Character, msgToReply: Message = null) {
let opts = {
username: parseServerNickname(char),
avatarURL: char.avatar_url,
...options
};
if (channel.isThread()) {
opts = { threadId: channel.id, ...opts };
}
const rpHook = await this.findOrCreateRpHook(channel);
if (rpHook) {
if (msgToReply) {
const payload = MessagePayload.create(rpHook, { reply: { messageReference: msgToReply.id }, ...opts });
return rpHook.send(payload);
}
return rpHook.send(opts);
} else {
console.log('unable to find or create webhook for:' + channel.id);
}
return null;
}
public async sendRpMessage(options: WebhookMessageCreateOptions, channel: GuildTextBasedChannel, char: Character, msgToReply: Message = null) {
let opts = {
username: parseServerNickname(char),
avatarURL: char.avatar_url,
...options
};
if (channel.isThread()) {
opts = { threadId: channel.id, ...opts };
}
const rpHook = await this.findOrCreateRpHook(channel);
if (rpHook) {
if (msgToReply) {
const payload = MessagePayload.create(rpHook, { reply: { messageReference: msgToReply.id }, ...opts });
return rpHook.send(payload);
}
return rpHook.send(opts);
} else {
console.log('unable to find or create webhook for:' + channel.id);
}
return null;
}