File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Message } from "whatsapp-web.js" ;
2+
3+ export const info = {
4+ command : "fork" ,
5+ description : "Fork this bot on GitHub." ,
6+ usage : "fork" ,
7+ example : "fork" ,
8+ role : "user" ,
9+ cooldown : 5000 ,
10+ } ;
11+
12+ export default async function ( msg : Message ) {
13+ if ( ! / ^ f o r k \b / i. test ( msg . body ) ) return ;
14+
15+ await msg . reply (
16+ "Fork this bot at https://github.com/mrepol742/project-canis or contribute to the project by submitting issues or pull requests."
17+ ) ;
18+ }
Original file line number Diff line number Diff line change @@ -11,5 +11,6 @@ export const info = {
1111} ;
1212
1313export default function ( msg : Message ) {
14+ if ( ! / ^ p i n g \b / i. test ( msg . body ) ) return ;
1415 msg . reply ( "pong" ) ;
1516}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const info = {
1212} ;
1313
1414export default async function ( msg : Message ) {
15+ if ( ! / ^ r e s t a r t \b / i. test ( msg . body ) ) return ;
1516 await msg . react ( "🔄" ) ;
1617
1718 const tempDir = "./.temp" ;
Original file line number Diff line number Diff line change 1+ import { Message , MessageMedia } from "whatsapp-web.js" ;
2+ import axios from "axios" ;
3+ import log from "../components/utils/log" ;
4+ import { prisma } from "../components/prisma" ;
5+
6+ export const info = {
7+ command : "sql" ,
8+ description : "Execute a SQL query and return the result." ,
9+ usage : "sql <query>" ,
10+ example : "sql SELECT * FROM users WHERE active = true;" ,
11+ role : "admin" ,
12+ cooldown : 5000 ,
13+ } ;
14+
15+ export default async function ( msg : Message ) {
16+ const query = msg . body . replace ( / ^ s q l \b \s * / i, "" ) . trim ( ) ;
17+ if ( query . length === 0 ) {
18+ await msg . reply ( "Please provide a sql." ) ;
19+ return ;
20+ }
21+
22+ try {
23+ const result = await prisma . $queryRawUnsafe ( query ) ;
24+ await msg . reply ( JSON . stringify ( result , null , 2 ) ) ;
25+ } catch ( error : any ) {
26+ log . error ( "sql" , `Error querying data: ${ error . message } ` ) ;
27+ await msg . reply (
28+ `Error querying data for "${ query } ". Please try again later.`
29+ ) ;
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export const info = {
1414} ;
1515
1616export default async function ( msg : Message ) {
17+ if ( ! / ^ s t a t s \b / i. test ( msg . body ) ) return ;
1718 const stats = {
1819 OS : os . release ( ) ,
1920 arch : os . arch ( ) ,
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ export const info = {
1111} ;
1212
1313export default async function ( msg : Message ) {
14+ if ( ! / ^ u n s e n d \b / i. test ( msg . body ) ) return ;
15+
1416 if ( ! msg . hasQuotedMsg ) {
1517 await msg . reply ( "Please reply the message you want to unsend." ) ;
1618 return ;
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export const info = {
1313} ;
1414
1515export default async function ( msg : Message ) {
16+ if ( ! / ^ u p t i m e \b / i. test ( msg . body ) ) return ;
17+
1618 const uptimeMinutes = Math . floor ( process . uptime ( ) / 60 ) ;
1719 const statsMessage = `
1820 *${ uptimeMinutes } minutes*
You can’t perform that action at this time.
0 commit comments