mirror of
				https://github.com/keanuplayz/TravBot-v3.git
				synced 2024-08-15 02:33:12 +00:00 
			
		
		
		
	
							parent
							
								
									985db250d9
								
							
						
					
					
						commit
						52c1420508
					
				
					 3 changed files with 64 additions and 34 deletions
				
			
		|  | @ -61,6 +61,29 @@ export default new NamedCommand({ | |||
|                         }) | ||||
|                     }) | ||||
|                 }), | ||||
|                 messageembeds: new NamedCommand({ | ||||
|                     description: "Enable or disable sending message previews.", | ||||
|                     usage: "enable/disable", | ||||
|                     run: "Please specify `enable` or `disable`.", | ||||
|                     subcommands: { | ||||
|                         true: new NamedCommand({ | ||||
|                             description: "Enable sending of message previews.", | ||||
|                             async run({send, guild}) { | ||||
|                                 Storage.getGuild(guild!.id).messageEmbeds = true; | ||||
|                                 Storage.save(); | ||||
|                                 send("Sending of message previews has been enabled."); | ||||
|                             } | ||||
|                         }), | ||||
|                         false: new NamedCommand({ | ||||
|                             description: "Disable sending of message previews.", | ||||
|                             async run({send, guild}) { | ||||
|                                 Storage.getGuild(guild!.id).messageEmbeds = false; | ||||
|                                 Storage.save(); | ||||
|                                 send("Sending of message previews has been disabled."); | ||||
|                             } | ||||
|                         }) | ||||
|                     } | ||||
|                 }), | ||||
|                 autoroles: new NamedCommand({ | ||||
|                     description: "Configure your server's autoroles.", | ||||
|                     usage: "<roles...>", | ||||
|  |  | |||
|  | @ -2,8 +2,12 @@ import {client} from "../index"; | |||
| import {MessageEmbed} from "discord.js"; | ||||
| import {getPrefix} from "../structures"; | ||||
| import {getMessageByID} from "onion-lasers"; | ||||
| import {Storage} from "../structures"; | ||||
| 
 | ||||
| client.on("message", async (message) => { | ||||
|     const {messageEmbeds} = Storage.getGuild(message.guild!.id); | ||||
| 
 | ||||
|     if (messageEmbeds) { | ||||
|         // Only execute if the message is from a user and isn't a command.
 | ||||
|         if (message.content.startsWith(getPrefix(message.guild)) || message.author.bot) return; | ||||
|         const messageLink = extractFirstMessageLink(message.content); | ||||
|  | @ -46,6 +50,7 @@ client.on("message", async (message) => { | |||
|         } | ||||
| 
 | ||||
|         return await message.channel.send(infoEmbed); | ||||
|     } else return; | ||||
| }); | ||||
| 
 | ||||
| export function extractFirstMessageLink(message: string): [string, string, string] | null { | ||||
|  |  | |||
|  | @ -79,6 +79,7 @@ class Member { | |||
| 
 | ||||
| class Guild { | ||||
|     public prefix: string | null; | ||||
|     public messageEmbeds: boolean | null; | ||||
|     public welcomeType: "none" | "text" | "graphical"; | ||||
|     public welcomeChannel: string | null; | ||||
|     public welcomeMessage: string | null; | ||||
|  | @ -90,6 +91,7 @@ class Guild { | |||
| 
 | ||||
|     constructor(data?: GenericJSON) { | ||||
|         this.prefix = select(data?.prefix, null, String); | ||||
|         this.messageEmbeds = select(data?.messageLinks, true, Boolean); | ||||
|         this.welcomeChannel = select(data?.welcomeChannel, null, String); | ||||
|         this.welcomeMessage = select(data?.welcomeMessage, null, String); | ||||
|         this.autoRoles = select(data?.autoRoles, null, String, true); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue