renamed stuff to be camel case since apparently I got that convention wrong

This commit is contained in:
Aster Fialla
2026-02-13 20:37:02 -05:00
parent 9f374af432
commit 2ddec02569
3 changed files with 27 additions and 27 deletions

View File

@@ -1,21 +1,21 @@
const wh = {};
wh.get_or_create_webhook = async function (api, channel_id) {
wh.getOrCreateWebhook = async function (api, channelId) {
const name = 'PluralFlux Proxy Webhook';
let webhook = await get_webhook(api, channel_id, name);
let webhook = await getWebhook(api, channelId, name);
if (webhook === undefined) {
webhook = await api.channels.createWebhook(channel_id, {name: name});
webhook = await api.channels.createWebhook(channelId, {name: name});
}
return webhook;
}
async function get_webhook(api, channel_id, name) {
const all_webhooks = await api.channels.getWebhooks(channel_id);
if (all_webhooks.length === 0) {
async function getWebhook(api, channelId, name) {
const allWebhooks = await api.channels.getWebhooks(channelId);
if (allWebhooks.length === 0) {
return;
}
let pf_webhook;
all_webhooks.forEach((webhook) => {
allWebhooks.forEach((webhook) => {
if (webhook.name === name) {
pf_webhook = webhook;
}
@@ -23,9 +23,9 @@ async function get_webhook(api, channel_id, name) {
return pf_webhook;
}
wh.replace_message = async function (api, data, text, member) {
wh.replaceMessage = async function (api, data, text, member) {
if (text.length > 0) {
const webhook = await wh.get_or_create_webhook(api, data.channel_id);
const webhook = await wh.getOrCreateWebhook(api, data.channel_id);
await api.webhooks.execute(webhook.id, webhook.token, {content: text, username: member.displayname ?? member.name, propic: member.propic});
await api.channels.deleteMessage(data.channel_id, data.id);
}