2021-11-18 18:56:42 +01:00
const client = require ( ".." ) ;
2023-04-06 14:23:31 +02:00
const { EmbedBuilder , ChannelType } = require ( "discord.js" ) ;
2023-04-02 14:12:53 +02:00
const Utils = require ( "../util/functions/function" ) ;
2022-01-31 20:01:40 +01:00
const domains = require ( "../util/Data/domains.json" ) ;
2021-09-06 12:38:25 +02:00
client . on ( "messageCreate" , async message => {
2021-09-17 18:28:39 +02:00
if ( message . author . bot || ! message . guild ) return ;
2021-11-18 18:56:42 +01:00
const data = { } ;
const guildDB = await client . data . getGuild ( message . guild . id ) ;
if ( ! guildDB ) return ;
const userDB = await client . data . getUser ( message . author ? . id ) ;
if ( ! userDB ) return ;
data . Guild = guildDB ;
data . User = userDB ;
if ( ! guildDB ) await client . data . CreateGuild ( message . guild . id ) ;
2021-09-06 12:38:25 +02:00
if ( message . content . match ( new RegExp ( ` ^<@!? ${ client . user . id } >( |) $ ` ) ) ) {
2022-10-26 12:38:28 +02:00
const _ = new EmbedBuilder ( )
2021-11-18 18:56:42 +01:00
. addFields (
{
name : "Prefix/Usage" ,
value : "Run `/help` to start using the bot" ,
inline : true ,
} ,
{
name : ":link: **Invite Me**" ,
2023-04-02 14:12:53 +02:00
value : ` [Click Here]( ${ Utils . inviteLink ( client ) } ) ` ,
2021-11-18 18:56:42 +01:00
inline : true ,
} ,
{
name : "<:support1:867093614403256350> **Need Help ?**" ,
value : ` Join our [Support Server](https://discord.gg/SbQHChmGcp) ` ,
inline : true ,
} ,
{
name : "<:YouTube:841186450497339412> **Video Guide**" ,
value : ` [How to use Slash Coammands](https://youtu.be/YSKDu1gKntY) ` ,
inline : true ,
} ,
{
name : ` <:nyx_description:897379659665264650> Documentation ` ,
value : ` [Click here]( ${ client . docs } ) ` ,
inline : true ,
} ,
{
name : "<a:donate:896985486260846614> **Support us**" ,
value : ` [KoFi](https://ko-fi.com/cathteam) ` ,
inline : true ,
} ,
{
name : "<a:booster:896527475063025704> **Premium**" ,
2022-03-20 08:19:22 +01:00
value : ` You can either boost the support server or subscribe to developer's team [Ko-Fi](https://ko-fi.com/cathteam). \n Another option would be to gift a nitro subscription to one of the developers. ` ,
2021-11-18 18:56:42 +01:00
inline : false ,
}
2021-09-06 12:38:25 +02:00
)
2021-11-18 18:56:42 +01:00
. setTitle ( client . user . username )
2023-04-02 14:12:53 +02:00
. setThumbnail ( client . user . displayAvatarURL ( { dynamic : true } ) )
2021-09-06 12:38:25 +02:00
. setURL ( client . web )
2022-10-26 12:38:28 +02:00
. setFooter ( {
text : ` Made by ${ client . author } ` ,
2023-04-02 14:12:53 +02:00
iconURL : client . user . displayAvatarURL ( { dynamic : true } ) ,
2022-10-26 12:38:28 +02:00
} )
2021-09-06 12:38:25 +02:00
. setTimestamp ( )
. setColor ( client . color ) ;
2023-04-13 15:50:37 +02:00
try {
const m = await message . reply ( {
embeds : [ _ ] ,
components : Utils . buttons ( client ) ,
} ) ;
setTimeout ( ( ) => m . delete ( ) , 15000 ) ;
} catch ( _ ) { }
2021-09-06 12:38:25 +02:00
}
2021-11-18 18:56:42 +01:00
if ( data . User ? . Blacklist ) return ;
2023-04-14 14:33:26 +02:00
try {
if (
domains . iplogger . includes (
message . content
. toLowerCase ( )
. match (
/(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
) ? . [ 0 ]
. replace ( /(https|http):\/\/+/g , "" )
. match ( /\s*([^)]+?)\s*\/+/g , "" ) [ 0 ]
. slice ( 0 , - 1 )
) ||
domains . scam . includes (
message . content
. toLowerCase ( )
. match (
/(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
) ? . [ 0 ]
. replace ( /(https|http):\/\/+/g , "" )
. match ( /\s*([^)]+?)\s*\/+/g , "" ) [ 0 ]
. slice ( 0 , - 1 )
) ||
domains . ngrok . includes (
message . content
. toLowerCase ( )
. match (
/(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
) ? . [ 0 ]
. replace ( /(https|http):\/\/+/g , "" )
. match ( /\s*([^)]+?)\s*\/+/g , "" ) [ 0 ]
. slice ( 0 , - 1 )
2022-01-31 20:01:40 +01:00
)
2023-04-14 14:33:26 +02:00
) {
const _ = new EmbedBuilder ( )
. setTitle ( ` Scam/IP Grabber detected ` )
. setTimestamp ( )
. setColor ( client . color )
. addFields (
2022-02-01 21:01:05 +01:00
{
2023-04-14 14:33:26 +02:00
name : "User" ,
value : ` ${ message . author . tag } ( ${ message . author . id } ) ` ,
inline : true ,
2022-02-01 21:01:05 +01:00
} ,
{
2023-04-14 14:33:26 +02:00
name : "Scam/IP Logger URL" ,
value : ` ||https:// ${ message . content
. toLowerCase ( )
. match (
/(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g
) ? . [ 0 ]
. replace ( /(https|http):\/\/+/g , "" )
. match ( /\s*([^)]+?)\s*\/+/g , "" ) [ 0 ]
. slice ( 0 , - 1 ) } || ` ,
2022-02-01 21:01:05 +01:00
inline : true ,
}
2023-04-14 14:33:26 +02:00
)
. setFooter ( {
text : ` Tactical Protection by ${ client . author } ` ,
icon _url : client . user . displayAvatarURL ( { dynamic : true } ) ,
} ) ;
message . channel . send ( {
embeds : [ _ ] ,
} ) ;
client . channels . cache . get ( client . config . ScamLinkLog ) . send ( {
embeds : [
_ . addFields (
{
name : "Message" ,
value : message . content ,
inline : false ,
} ,
{
name : "Guild" ,
value : message . guild ? message . guild . name : "None" ,
inline : true ,
}
) ,
] ,
} ) ;
message . delete ( ) . catch ( ( ) => { } ) ;
}
} catch ( _ ) { }
2022-01-31 20:01:40 +01:00
2021-11-18 18:56:42 +01:00
if (
message ? . content . startsWith ( data . Guild . Prefix ) ||
2023-04-06 14:23:31 +02:00
message ? . content . toLowerCase ( ) . startsWith ( "c." )
2021-11-18 18:56:42 +01:00
) {
2022-10-26 12:38:28 +02:00
const embed = new EmbedBuilder ( )
2021-11-18 18:56:42 +01:00
. setTitle ( ` Message commands are now disabled ` )
. setDescription (
` Please enable **Use Application Commands** in the channel settings to get access to slash commands, we have discontinued message commands \n \n Use \` /help \` to see more info `
)
. setColor ( client . color )
. setThumbnail ( message . guild . iconURL ( { dynamic : true } ) )
. addFields (
{
name : ":link: **Invite Me**" ,
2023-04-02 14:12:53 +02:00
value : ` [Click Here]( ${ Utils . inviteLink ( client . user . id ) } ) ` ,
2021-11-18 18:56:42 +01:00
inline : true ,
} ,
{
name : "<:support1:867093614403256350> **Need Help ?**" ,
value : ` Join our [Support Server](https://discord.gg/SbQHChmGcp) ` ,
inline : true ,
} ,
{
name : "<:YouTube:841186450497339412> **Video Guide**" ,
value : ` [How to use Slash Coammands](https://youtu.be/YSKDu1gKntY) ` ,
inline : true ,
} ,
{
name : ` <:nyx_description:897379659665264650> Documentation ` ,
value : ` [Click here]( ${ client . docs } ) ` ,
inline : true ,
} ,
{
name : "<a:donate:896985486260846614> **Support us**" ,
value : ` [KoFi](https://ko-fi.com/cathteam) ` ,
inline : true ,
} ,
{
name : "<a:booster:896527475063025704> **Premium**" ,
value : ` You can either boost support server or subscribe to developer's team [Ko-Fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team. ` ,
inline : false ,
2021-09-17 18:28:39 +02:00
}
2021-11-18 18:56:42 +01:00
)
. setURL ( client . web )
2022-10-26 12:38:28 +02:00
. setFooter ( {
text : ` Requested by ${ message . author . tag } ` ,
iconURL : message . author . displayAvatarURL ( { dynamic : true } ) ,
} )
2023-04-06 14:23:31 +02:00
. setThumbnail (
2023-04-14 14:34:41 +02:00
"https://raw.githubusercontent.com/night0721/cath.exe/main/util/assets/images/nyx_logo_transparent.webp"
2023-04-06 14:23:31 +02:00
)
2021-11-18 18:56:42 +01:00
. setTimestamp ( ) ;
message . reply ( {
embeds : [ embed ] ,
2023-04-06 14:23:31 +02:00
components : Utils . buttons ( client ) ,
2021-11-18 18:56:42 +01:00
} ) ;
2021-09-06 12:38:25 +02:00
}
} ) ;
client . on ( "messageCreate" , async message => {
2023-04-06 14:23:31 +02:00
if ( message . channel . type === ChannelType . DM && ! message . author . bot ) {
2021-11-18 18:56:42 +01:00
if ( message . attachments && message ? . content ) {
message . attachments . map ( e =>
client . channels . cache . get ( client . config . DMLog ) . send ( {
content : ` \` ${ message . author . tag } ( ${ message . author . id } ) \` : ${
message . content + e . url
} ` ,
} )
) ;
2021-09-06 12:38:25 +02:00
} else {
2021-11-18 18:56:42 +01:00
message . attachments . map ( e =>
client . channels . cache . get ( client . config . DMLog ) . send ( {
content : ` \` ${ message . author . tag } ( ${ message . author . id } ) \` : ${ e . url } ` ,
} )
) ;
}
if ( message . content ) {
client . channels . cache . get ( client . config . DMLog ) . send ( {
2022-01-31 20:01:40 +01:00
embeds : [
2022-10-26 12:38:28 +02:00
new EmbedBuilder ( )
2022-01-31 20:01:40 +01:00
. setDescription ( message . content )
. setColor ( client . color )
. setAuthor ( {
name : message . author . tag ,
iconURL : message . author . displayAvatarURL ( { dynamic : true } ) ,
} ) ,
] ,
2021-09-06 12:38:25 +02:00
} ) ;
}
}
} ) ;