-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add memechan live coins list into settings
- Loading branch information
Showing
8 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const MEMECHAN_LIVE_COIN_CALLBACK_QUERY_DATA_PREFIX = 'memechan-live-coins-'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import goHome from '../../inline-keyboards/goHome'; | ||
import { BotContext } from '../../types'; | ||
import { getMemechanLiveCoinsList, getSuiScanCoinLink } from '../utils'; | ||
|
||
export async function showMemechanLiveCoinsList(ctx: BotContext) { | ||
const coinWhitelist = await getMemechanLiveCoinsList(); | ||
|
||
if (coinWhitelist === null) { | ||
await ctx.reply('Failed to fetch memechan live coins list. Please, try again later or contact support.', { | ||
reply_markup: goHome, | ||
}); | ||
|
||
return; | ||
} | ||
|
||
let whitelistString = '🪙 <b>Memechan Live Coins</b> 🪙\n\n'; | ||
coinWhitelist.forEach( | ||
(coinData) => (whitelistString += `<a href="${getSuiScanCoinLink(coinData.type)}">${coinData.symbol}</a>\n`), | ||
); | ||
|
||
await ctx.reply(whitelistString, { | ||
reply_markup: goHome, | ||
parse_mode: 'HTML', | ||
link_preview_options: { is_disabled: true }, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MEMECHAN_LIVE_COIN_CALLBACK_QUERY_DATA_PREFIX } from './config'; | ||
|
||
export function getMemechanCoinCallbackQueryData(coinIndex: number): string { | ||
return `${MEMECHAN_LIVE_COIN_CALLBACK_QUERY_DATA_PREFIX}${coinIndex}`; | ||
} | ||
|
||
export function getMemechanCoinIndexFromCallbackQueryData(callbackQueryData: string): number { | ||
const prefixLength = MEMECHAN_LIVE_COIN_CALLBACK_QUERY_DATA_PREFIX.length; | ||
|
||
return +callbackQueryData.substring(prefixLength); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// eslint-disable-next-line max-len | ||
// Source: https://7mgmqkuj18.execute-api.us-east-1.amazonaws.com/prod/live/coins?sortBy=lastReply&direction=desc&status=LIVE | ||
export default [ | ||
{ | ||
symbol: 'RINWIF', | ||
type: '0x4c023b94ba2e42e5ce1400191d0228216359f4de894150b813b1f514d2668426::rinwif::RINWIF', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters