File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,18 +3,19 @@ import axios from "axios";
33import log from "npmlog" ;
44import fs from "fs/promises" ;
55import { client } from "../components/client" ;
6+ import Font from "../components/font" ;
67
78export const command = "pickupline" ;
89export const role = "user" ;
910
1011export default async function ( msg : Message ) {
1112 await axios
12- . get ( `https://api.popcat.xyz/pickupline ` )
13+ . get ( `https://api.popcat.xyz/pickuplines ` )
1314 . then ( async ( response ) => {
14- await msg . reply ( response . data . pickupline ) ;
15+ await msg . reply ( Font ( response . data . pickupline ) ) ;
1516 } )
1617 . catch ( async ( error ) => {
1718 log . error ( "pickupline" , `Error fetching data: ${ error . message } ` ) ;
18- await msg . reply ( `Error fetching data . Please try again later.` ) ;
19+ await msg . reply ( `Error fetching data. Please try again later.` ) ;
1920 } ) ;
2021}
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ const messageEvent = (msg: Message) => {
3636 // ignore message if it is older than 10 seconds
3737 if ( msg . timestamp < Date . now ( ) / 1000 - 10 ) return ;
3838
39+ // process normalization
40+ msg . body = msg . body . normalize ( "NFKC" ) ;
41+
3942 const prefix = ! msg . body . startsWith ( commandPrefix ) ;
4043 const senderId = msg . from . split ( "@" ) [ 0 ] ;
4144
Original file line number Diff line number Diff line change 1+ const mathSansMap : Record < string , string > = {
2+ a : "𝖺" ,
3+ b : "𝖻" ,
4+ c : "𝖼" ,
5+ d : "𝖽" ,
6+ e : "𝖾" ,
7+ f : "𝖿" ,
8+ g : "𝗀" ,
9+ h : "𝗁" ,
10+ i : "𝗂" ,
11+ j : "𝗃" ,
12+ k : "𝗄" ,
13+ l : "𝗅" ,
14+ m : "𝗆" ,
15+ n : "𝗇" ,
16+ o : "𝗈" ,
17+ p : "𝗉" ,
18+ q : "𝗊" ,
19+ r : "𝗋" ,
20+ s : "𝗌" ,
21+ t : "𝗍" ,
22+ u : "𝗎" ,
23+ v : "𝗏" ,
24+ w : "𝗐" ,
25+ x : "𝗑" ,
26+ y : "𝗒" ,
27+ z : "𝗓" ,
28+ A : "𝖠" ,
29+ B : "𝖡" ,
30+ C : "𝖢" ,
31+ D : "𝖣" ,
32+ E : "𝖤" ,
33+ F : "𝖥" ,
34+ G : "𝖦" ,
35+ H : "𝖧" ,
36+ I : "𝖨" ,
37+ J : "𝖩" ,
38+ K : "𝖪" ,
39+ L : "𝖫" ,
40+ M : "𝖬" ,
41+ N : "𝖭" ,
42+ O : "𝖮" ,
43+ P : "𝖯" ,
44+ Q : "𝖰" ,
45+ R : "𝖱" ,
46+ S : "𝖲" ,
47+ T : "𝖳" ,
48+ U : "𝖴" ,
49+ V : "𝖵" ,
50+ W : "𝖶" ,
51+ X : "𝖷" ,
52+ Y : "𝖸" ,
53+ Z : "𝖹" ,
54+ 1 : "𝟣" ,
55+ 2 : "𝟤" ,
56+ 3 : "𝟥" ,
57+ 4 : "𝟦" ,
58+ 5 : "𝟧" ,
59+ 6 : "𝟨" ,
60+ 7 : "𝟩" ,
61+ 8 : "𝟪" ,
62+ 9 : "𝟫" ,
63+ 0 : "𝟢" ,
64+ } ;
65+
66+ export default function Font ( text : string ) {
67+ return text
68+ . split ( " " )
69+ . map ( function ( char ) {
70+ if ( / ^ ( h t t p | h t t p s ) : \/ \/ / . test ( char ) ) {
71+ return char ;
72+ }
73+ if (
74+ / ^ ( h t t p s ? : \/ \/ ) ? (?: w w w \. ) ? ( [ a - z A - Z 0 - 9 - ] + \. ) { 1 , } [ a - z A - Z ] { 2 , } (?: \/ [ ^ \s ] * ) ? $ / . test (
75+ char
76+ )
77+ )
78+ return char ;
79+ return char
80+ . split ( "" )
81+ . map ( function ( char ) {
82+ return mathSansMap [ char ] ;
83+ } )
84+ . join ( "" ) ;
85+ } )
86+ . join ( " " ) ;
87+ }
You can’t perform that action at this time.
0 commit comments