Skip to content

Commit

Permalink
fix: find & replace require with import
Browse files Browse the repository at this point in the history
While both import and require can be used to import modules
in TypeScript, it is recommended to use import because it is
part of the ES6 module system and provides better performance.
  • Loading branch information
Mersho committed Nov 1, 2023
1 parent 0b49124 commit de22872
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { connect as mongoConnect } from './db_connect'
const { resubscribeInvoices } = require('./ln');
import { logger } from "./logger";
import { Telegraf } from "telegraf";
const { delay } = require('./util');
import { delay } from './util';

(async () => {
process.on('unhandledRejection', e => {
Expand Down
2 changes: 1 addition & 1 deletion bot/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Dispute,
Config,
} from '../models';
const { getCurrenciesWithPrice, deleteOrderFromChannel } = require('../util');
import { getCurrenciesWithPrice, deleteOrderFromChannel } from '../util';
const {
commandArgsMiddleware,
stageMiddleware,
Expand Down
4 changes: 2 additions & 2 deletions bot/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const { parsePaymentRequest } = require('invoices');
const { ObjectId } = require('mongoose').Types;
import * as messages from './messages';
import { Order, User, Community } from '../models';
const { isIso4217, isDisputeSolver } = require('../util');
const { existLightningAddress } = require('../lnurl/lnurl-pay');
import { isIso4217, isDisputeSolver } from '../util';
import { existLightningAddress } from '../lnurl/lnurl-pay';
import { logger } from '../logger';

// We look in database if the telegram user exists,
Expand Down
2 changes: 1 addition & 1 deletion jobs/pending_payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Telegraf } from 'telegraf';
import { I18nContext } from '@grammyjs/i18n';
import { MainContext } from '../bot/start';
const { payRequest, isPendingPayment } = require('../ln');
const { getUserI18nContext } = require('../util');
import { getUserI18nContext } from '../util';

export const attemptPendingPayments = async (bot: Telegraf<MainContext>): Promise<void> => {
const pendingPayments = await PendingPayment.find({
Expand Down
2 changes: 1 addition & 1 deletion ln/subscribe_invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { payToBuyer } = require('./pay_request');
import { lnd } from "./connect";
import * as messages from '../bot/messages';
const ordersActions = require('../bot/ordersActions');
const { getUserI18nContext, getEmojiRate, decimalRound } = require('../util');
import { getUserI18nContext, getEmojiRate, decimalRound } from '../util';
import { logger } from '../logger';

const subscribeInvoice = async (bot: Telegraf<MainContext>, id: string, resub: boolean) => {
Expand Down

0 comments on commit de22872

Please sign in to comment.