Skip to content

Commit

Permalink
🔄️ move DiscordWebhook to classes
Browse files Browse the repository at this point in the history
  • Loading branch information
idinium96 committed Oct 27, 2023
1 parent 2e766cb commit 687c8a1
Show file tree
Hide file tree
Showing 29 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const botManager = new BotManager(

import ON_DEATH from 'death';
import * as inspect from 'util';
import { Webhook } from './lib/DiscordWebhook/interfaces';
import { Webhook } from './classes/DiscordWebhook/interfaces';
import axios, { AxiosError } from 'axios';
import { uptime } from './lib/tools/time';
import filterAxiosError from '@tf2autobot/filter-axios-error';
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Autokeys/Autokeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Bot from '../Bot';
import { EntryData, KeyPrices, PricelistChangedSource } from '../Pricelist';
import log from '../../lib/logger';
import { currPure } from '../../lib/tools/pure';
import sendAlert from '../../lib/DiscordWebhook/sendAlert';
import sendAlert from '../DiscordWebhook/sendAlert';

export interface OverallStatus {
isBuyingKeys: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Groups from './Groups';

import log from '../lib/logger';
import Bans, { IsBanned } from '../lib/bans';
import { sendStats } from '../lib/DiscordWebhook/export';
import { sendStats } from './DiscordWebhook/export';

import Options from './Options';
import IPricer from './IPricer';
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Carts/Cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Bot from '../Bot';
import Pricelist from '../Pricelist';
import { BPTFGetUserInfo } from '../MyHandler/interfaces';
import log from '../../lib/logger';
import { sendAlert } from '../../lib/DiscordWebhook/export';
import { sendAlert } from '../DiscordWebhook/export';
import filterAxiosError from '@tf2autobot/filter-axios-error';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Carts/CartQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pluralize from 'pluralize';
import Cart from './Cart';
import Bot from '../Bot';
import log from '../../lib/logger';
import { sendAlert } from '../../lib/DiscordWebhook/export';
import { sendAlert } from '../DiscordWebhook/export';
import { uptime } from '../../lib/tools/export';
import { isBptfBanned } from '../../lib/bans';

Expand Down
2 changes: 1 addition & 1 deletion src/classes/Commands/sub-classes/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Bot from '../../Bot';
import CommandParser from '../../CommandParser';
import log from '../../../lib/logger';
import { generateLinks, timeNow } from '../../../lib/tools/export';
import { sendPartnerMessage, sendAdminMessage } from '../../../lib/DiscordWebhook/export';
import { sendPartnerMessage, sendAdminMessage } from '../../DiscordWebhook/export';

export default class MessageCommand {
constructor(private readonly bot: Bot) {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Commands/sub-classes/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as timersPromises from 'timers/promises';
import Bot from '../../Bot';
import CommandParser from '../../CommandParser';
import { stats, profit, itemStats, testPriceKey } from '../../../lib/tools/export';
import { sendStats } from '../../../lib/DiscordWebhook/export';
import { sendStats } from '../../DiscordWebhook/export';
import loadPollData, { deletePollData } from '../../../lib/tools/polldata';
import SteamTradeOfferManager from '@tf2autobot/tradeoffer-manager';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import * as timersPromises from 'timers/promises';
import { UnknownDictionary } from '../../types/common';
import { Webhook, sendWebhook } from './export';

import log from '../logger';
import { BuyAndSell } from '../../classes/Pricelist';
import Options from '../../classes/Options';
import log from '../../lib/logger';
import { BuyAndSell } from '../Pricelist';
import Options from '../Options';
import { WebhookError } from './utils';
import { BotInfo } from '../../classes/MyHandler/MyHandler';
import { BotInfo } from '../MyHandler/MyHandler';

const australiumImageURL: { [defindex: number]: string } = {
// Australium Ambassador
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import { GetItemPriceResponse } from '../../classes/IPricer';
import log from '../../lib/logger';
import { GetItemPriceResponse } from '../IPricer';
import * as timersPromises from 'timers/promises';
import { UnknownDictionary } from '../../types/common';
import Options from '../../classes/Options';
import { BotInfo } from '../../classes/MyHandler/MyHandler';
import Options from '../Options';
import { BotInfo } from '../MyHandler/MyHandler';

export default function sendFailedPriceUpdate(
data: GetItemPriceResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { quickLinks, sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import Bot from '../../classes/Bot';
import log from '../../lib/logger';
import Bot from '../Bot';

export default function sendAdminMessage(
steamID: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TradeOfferManager, { CustomError } from '@tf2autobot/tradeoffer-manager';
import { sendWebhook, WebhookError } from './utils';
import { Webhook } from './interfaces';
import { timeNow, uptime } from '../tools/time';
import Bot from '../../classes/Bot';
import { timeNow, uptime } from '../../lib/tools/time';
import Bot from '../Bot';
import * as timersPromises from 'timers/promises';

type AlertType =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TradeOffer } from '@tf2autobot/tradeoffer-manager';
import { quickLinks, sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import { pure, summarizeToChat, listItems, replace, ValueDiff } from '../tools/export';
import log from '../../lib/logger';
import { pure, summarizeToChat, listItems, replace, ValueDiff } from '../../lib/tools/export';

import Bot from '../../classes/Bot';
import { KeyPrices } from '../../classes/Pricelist';
import { sendToAdmin } from '../../classes/MyHandler/offer/review/send-review';
import Bot from '../Bot';
import { KeyPrices } from '../Pricelist';
import { sendToAdmin } from '../MyHandler/offer/review/send-review';

export default function sendOfferReview(
offer: TradeOffer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { quickLinks, sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import Bot from '../../classes/Bot';
import log from '../../lib/logger';
import Bot from '../Bot';

export default function sendPartnerMessage(
steamID: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import pluralize from 'pluralize';
import SteamID from 'steamid';
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import log from '../../lib/logger';
import { stats, profit, timeNow } from '../../lib/tools/export';
import Bot from '../../classes/Bot';
import loadPollData from '../tools/polldata';
import Bot from '../Bot';
import loadPollData from '../../lib/tools/polldata';

export default async function sendStats(bot: Bot, forceSend = false, steamID?: SteamID): Promise<void> {
const optDW = bot.options.discordWebhook;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import Bot from '../../classes/Bot';
import { timeNow } from '../tools/time';
import log from '../../lib/logger';
import Bot from '../Bot';
import { timeNow } from '../../lib/tools/time';

export default function sendTf2DisplayNotification(bot: Bot, title: string, body: string): void {
const opt = bot.options.discordWebhook;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import Bot from '../../classes/Bot';
import { timeNow } from '../tools/time';
import log from '../../lib/logger';
import Bot from '../Bot';
import { timeNow } from '../../lib/tools/time';

export default function sendTf2ItemBroadcast(
bot: Bot,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import Bot from '../../classes/Bot';
import { timeNow } from '../tools/time';
import log from '../../lib/logger';
import Bot from '../Bot';
import { timeNow } from '../../lib/tools/time';

export default function sendTf2SystemMessage(bot: Bot, message: string): void {
const opt = bot.options.discordWebhook;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Action, TradeOffer } from '@tf2autobot/tradeoffer-manager';
import { getPartnerDetails, quickLinks, sendWebhook } from './utils';
import Bot from '../../classes/Bot';
import * as t from '../tools/export';
import log from '../logger';
import Bot from '../Bot';
import * as t from '../../lib/tools/export';
import log from '../../lib/logger';
import { Webhook } from './export';
import { sendToAdmin } from '../../classes/MyHandler/offer/processDeclined';
import { sendToAdmin } from '../MyHandler/offer/processDeclined';

export default async function sendTradeDeclined(
offer: TradeOffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import pluralize from 'pluralize';
import Currencies from '@tf2autobot/tf2-currencies';
import { getPartnerDetails, quickLinks, sendWebhook } from './utils';
import { Webhook } from './interfaces';
import log from '../logger';
import * as t from '../tools/export';
import Bot from '../../classes/Bot';
import { sendToAdmin } from '../../classes/MyHandler/offer/accepted/processAccepted';
import log from '../../lib/logger';
import * as t from '../../lib/tools/export';
import Bot from '../Bot';
import { sendToAdmin } from '../MyHandler/offer/accepted/processAccepted';

export default async function sendTradeSummary(
offer: TradeOffer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TradeOfferManager, { TradeOffer } from '@tf2autobot/tradeoffer-manager';
import axios, { AxiosError } from 'axios';
import { Webhook } from './interfaces';
import Bot from '../../classes/Bot';
import log from '../logger';
import Bot from '../Bot';
import log from '../../lib/logger';
import filterAxiosError, { ErrorFiltered } from '@tf2autobot/filter-axios-error';

export function getPartnerDetails(offer: TradeOffer, bot: Bot): Promise<{ personaName: string; avatarFull: any }> {
Expand Down
8 changes: 4 additions & 4 deletions src/classes/MyHandler/MyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import * as files from '../../lib/files';
import { exponentialBackoff } from '../../lib/helpers';

import { noiseMakers } from '../../lib/data';
import { sendAlert } from '../../lib/DiscordWebhook/export';
import { sendAlert } from '../DiscordWebhook/export';
import { summarize, uptime, getHighValueItems, testPriceKey } from '../../lib/tools/export';

import genPaths from '../../resources/paths';
Expand All @@ -49,9 +49,9 @@ import Options, { OfferType } from '../Options';
import SteamTradeOfferManager from '@tf2autobot/tradeoffer-manager';
import filterAxiosError from '@tf2autobot/filter-axios-error';

import sendTf2SystemMessage from '../../lib/DiscordWebhook/sendTf2SystemMessage';
import sendTf2DisplayNotification from '../../lib/DiscordWebhook/sendTf2DisplayNotification';
import sendTf2ItemBroadcast from '../../lib/DiscordWebhook/sendTf2ItemBroadcast';
import sendTf2SystemMessage from '../DiscordWebhook/sendTf2SystemMessage';
import sendTf2DisplayNotification from '../DiscordWebhook/sendTf2DisplayNotification';
import sendTf2ItemBroadcast from '../DiscordWebhook/sendTf2ItemBroadcast';

const filterReasons = (reasons: string[]) => {
const filtered = new Set(reasons);
Expand Down
2 changes: 1 addition & 1 deletion src/classes/MyHandler/offer/accepted/processAccepted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Bot from '../../../Bot';
import { KeyPrices } from '../../../Pricelist';
import log from '../../../../lib/logger';
import * as t from '../../../../lib/tools/export';
import { sendTradeSummary } from '../../../../lib/DiscordWebhook/export';
import { sendTradeSummary } from '../../../DiscordWebhook/export';

export default function processAccepted(
offer: i.TradeOffer,
Expand Down
2 changes: 1 addition & 1 deletion src/classes/MyHandler/offer/accepted/updateListings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Bot from '../../../Bot';
import Pricelist, { EntryData } from '../../../Pricelist';
import { Attributes } from '../../../TF2GC';
import log from '../../../../lib/logger';
import { sendAlert } from '../../../../lib/DiscordWebhook/export';
import { sendAlert } from '../../../DiscordWebhook/export';
import { PaintedNames } from '../../../Options';
import { testPriceKey } from '../../../../lib/tools/export';

Expand Down
2 changes: 1 addition & 1 deletion src/classes/MyHandler/offer/processDeclined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as i from '@tf2autobot/tradeoffer-manager';
import SKU from '@tf2autobot/tf2-sku';
import Bot from '../../Bot';
import * as t from '../../../lib/tools/export';
import sendTradeDeclined from '../../../lib/DiscordWebhook/sendTradeDeclined';
import sendTradeDeclined from '../../DiscordWebhook/sendTradeDeclined';
import { KeyPrices } from '../../../classes/Pricelist';

export default function processDeclined(offer: i.TradeOffer, bot: Bot): void {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/MyHandler/offer/review/send-review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import processReview from './process-review';
import * as timersPromises from 'timers/promises';
import Bot from '../../../Bot';
import log from '../../../../lib/logger';
import { sendOfferReview } from '../../../../lib/DiscordWebhook/export';
import { sendOfferReview } from '../../../DiscordWebhook/export';
import * as t from '../../../../lib/tools/export';
import { KeyPrices } from 'src/classes/Pricelist';
import { Links } from '../../../../lib/tools/export';
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Pricelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Options from './Options';
import Bot from './Bot';
import log from '../lib/logger';
import validator from '../lib/validator';
import { sendWebHookPriceUpdateV1, sendAlert, sendFailedPriceUpdate } from '../lib/DiscordWebhook/export';
import { sendWebHookPriceUpdateV1, sendAlert, sendFailedPriceUpdate } from './DiscordWebhook/export';
import IPricer, { GetItemPriceResponse, Item } from './IPricer';

export enum PricelistChangedSource {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Trades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Inventory, { Dict } from './Inventory';

import log from '../lib/logger';
import { exponentialBackoff } from '../lib/helpers';
import { sendAlert } from '../lib/DiscordWebhook/export';
import { sendAlert } from './DiscordWebhook/export';
import { isBptfBanned } from '../lib/bans';
import * as t from '../lib/tools/export';

Expand Down

0 comments on commit 687c8a1

Please sign in to comment.