Skip to content

Commit

Permalink
fix: apply new logger import syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Mersho committed Dec 27, 2023
1 parent f3d4b6a commit b1b65a8
Show file tree
Hide file tree
Showing 37 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { SocksProxyAgent } = require('socks-proxy-agent');
const { start } = require('./bot');
const mongoConnect = require('./db_connect');
const { resubscribeInvoices } = require('./ln');
const logger = require('./logger');
const { logger } = require('./logger');
const { delay } = require('./util');

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion bot/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
const ordersActions = require('./ordersActions');

const { resolvLightningAddress } = require('../lnurl/lnurl-pay');
const logger = require('../logger');
const { logger } = require('../logger');

const waitPayment = async (ctx, bot, buyer, seller, order, buyerInvoice) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion bot/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
decimalRound,
getUserAge,
} = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');
import { MainContext } from './start';
import { UserDocument } from '../models/user'
import { IOrder } from '../models/order'
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/community/commands.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-underscore-dangle */
// @ts-check
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { showUserCommunitiesMessage } = require('./messages');
const { Community, Order } = require('../../../models');
const { validateParams, validateObjectId } = require('../../validations');
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/community/messages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { Community, PendingPayment } = require('../../../models');

exports.createCommunityWizardStatus = (i18n, state) => {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/community/scenes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Scenes } = require('telegraf');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { Community, User, PendingPayment } = require('../../../models');
const { isPendingPayment } = require('../../../ln');
const { isGroupAdmin, itemsFromMessage } = require('../../../util');
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/dispute/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
} = require('../../validations');
const messages = require('./messages');
const globalMessages = require('../../messages');
const logger = require('../../../logger');
const { logger } = require('../../../logger');

const dispute = async ctx => {
try {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/dispute/messages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getDisputeChannel, getDetailedOrder } = require('../../../util');
const logger = require('../../../logger');
const { logger } = require('../../../logger');

exports.beginDispute = async (ctx, initiator, order, buyer, seller) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/language/commands.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const fs = require('fs');
const { getLanguageFlag } = require('../../../util');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { showFlagsMessage } = require('./messages');

exports.setlang = async ctx => {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/language/messages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const logger = require('../../../logger');
const { logger } = require('../../../logger');

exports.showFlagsMessage = async (ctx, flags, code) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/nostr/commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Nostr = require('nostr-tools');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const Config = require('./config');

exports.info = async ctx => {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/nostr/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
require('websocket-polyfill');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const Config = require('./config');
const { orderCreated } = require('./events');
const Commands = require('./commands');
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/orders/commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { Community, Order } = require('../../../models');
const { isFloat } = require('../../../util');
const {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/orders/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { userMiddleware } = require('../../middleware/user');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const ordersActions = require('../../ordersActions');

const commands = require('./commands');
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/orders/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const {
sanitizeMD,
getTimeToExpirationOrder,
} = require('../../../util');
const logger = require('../../../logger');
const { logger } = require('../../../logger');

exports.listOrdersResponse = async (orders, i18n) => {
const tasks = orders.map(async order => {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/orders/scenes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Scenes, Markup } = require('telegraf');
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { getCurrency } = require('../../../util');
const ordersActions = require('../../ordersActions');
const {
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/orders/takeOrder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
const logger = require('../../../logger');
const { logger } = require('../../../logger');
const { Order } = require('../../../models');
const { deleteOrderFromChannel } = require('../../../util');
const messages = require('../../messages');
Expand Down
2 changes: 1 addition & 1 deletion bot/ordersActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
getFee,
getUserAge,
} = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');

const OrderEvents = require('./modules/events/orders');

Expand Down
2 changes: 1 addition & 1 deletion bot/scenes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { waitPayment, addInvoice, showHoldInvoice } = require('./commands');
const { getCurrency, getUserI18nContext } = require('../util');
const messages = require('./messages');
const { isPendingPayment } = require('../ln');
const logger = require('../logger');
const { logger } = require('../logger');

const addInvoiceWizard = new Scenes.WizardScene(
'ADD_INVOICE_WIZARD_SCENE_ID',
Expand Down
2 changes: 1 addition & 1 deletion bot/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const {
deleteCommunity,
nodeInfo,
} = require('../jobs');
const logger = require('../logger');
const { logger } = require('../logger');

export interface MainContext extends Context {
match: Array<string> | null;
Expand Down
2 changes: 1 addition & 1 deletion bot/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const messages = require('./messages');
const { Order, User, Community } = require('../models');
const { isIso4217, isDisputeSolver } = require('../util');
const { existLightningAddress } = require('../lnurl/lnurl-pay');
const logger = require('../logger');
const { logger } = require('../logger');

// We look in database if the telegram user exists,
// if not, it creates a new user
Expand Down
2 changes: 1 addition & 1 deletion db_connect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const mongoose = require('mongoose');
const logger = require('./logger');
const { logger } = require('./logger');

// connect to database
const credentials = process.env.DB_USER
Expand Down
2 changes: 1 addition & 1 deletion jobs/calculate_community_earnings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Order, Community } = require('../models');
const logger = require('../logger');
const { logger } = require('../logger');

const calculateEarnings = async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion jobs/cancel_orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { User, Order } = require('../models');
const { cancelShowHoldInvoice, cancelAddInvoice } = require('../bot/commands');
const messages = require('../bot/messages');
const { getUserI18nContext, holdInvoiceExpirationInSecs } = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');

const cancelOrders = async bot => {
try {
Expand Down
2 changes: 1 addition & 1 deletion jobs/communities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Order, Community } = require('../models');
const logger = require('../logger');
const { logger } = require('../logger');

const deleteCommunity = async bot => {
try {
Expand Down
2 changes: 1 addition & 1 deletion jobs/delete_published_orders.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { Order } = require('../models');
const { deleteOrderFromChannel } = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');

const deleteOrders = async bot => {
try {
Expand Down
2 changes: 1 addition & 1 deletion jobs/node_info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { Config } = require('../models');
const { getInfo } = require('../ln');
const logger = require('../logger');
const { logger } = require('../logger');

const info = async bot => {
try {
Expand Down
2 changes: 1 addition & 1 deletion jobs/pending_payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { payRequest, isPendingPayment } = require('../ln');
const { PendingPayment, Order, User, Community } = require('../models');
const messages = require('../bot/messages');
const { getUserI18nContext } = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');
import { Telegraf } from 'telegraf';
import { I18nContext } from '@grammyjs/i18n';
import { MainContext } from '../bot/start';
Expand Down
2 changes: 1 addition & 1 deletion ln/connect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const lightning = require('lightning');
const logger = require('../logger');
const { logger } = require('../logger');

const { authenticatedLndGrpc } = lightning;

Expand Down
2 changes: 1 addition & 1 deletion ln/hold_invoice.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { createHash, randomBytes } = require('crypto');
const lightning = require('lightning');
const lnd = require('./connect');
const logger = require('../logger');
const { logger } = require('../logger');

const createHoldInvoice = async ({ description, amount }) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion ln/info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const lightning = require('lightning');
const lnd = require('./connect');
const logger = require('../logger');
const { logger } = require('../logger');

const getInfo = async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion ln/pay_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { User, PendingPayment } = require('../models');
const lnd = require('./connect');
const { handleReputationItems, getUserI18nContext } = require('../util');
const messages = require('../bot/messages');
const logger = require('../logger');
const { logger } = require('../logger');

const payRequest = async ({ request, amount }) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion ln/resubscribe_invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getInvoices } = require('lightning');
const lnd = require('./connect');
const { subscribeInvoice } = require('./subscribe_invoice');
const { Order } = require('../models');
const logger = require('../logger');
const { logger } = require('../logger');

const resubscribeInvoices = async bot => {
try {
Expand Down
2 changes: 1 addition & 1 deletion ln/subscribe_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const lnd = require('./connect');
const messages = require('../bot/messages');
const ordersActions = require('../bot/ordersActions');
const { getUserI18nContext, getEmojiRate, decimalRound } = require('../util');
const logger = require('../logger');
const { logger } = require('../logger');

const subscribeInvoice = async (bot, id, resub) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion ln/subscribe_probe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { subscribeToProbeForRoute } = require('lightning');
const lnd = require('./connect');
const logger = require('../logger');
const { logger } = require('../logger');

const subscribeProbe = async (destination, tokens) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion lnurl/lnurl-pay.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const axios = require('axios').default;
const logger = require('../logger');
const { logger } = require('../logger');

// {
// pr: String, // bech32-serialized lightning invoice
Expand Down
2 changes: 1 addition & 1 deletion util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { I18n } = require('@grammyjs/i18n');
const currencies = require('./fiat.json');
const languages = require('./languages.json');
const { Order, Community } = require('../models');
const logger = require('../logger');
const { logger } = require('../logger');

// ISO 4217, all ISO currency codes are 3 letters but users can trade shitcoins
const isIso4217 = code => {
Expand Down

0 comments on commit b1b65a8

Please sign in to comment.