Add automated announcment for DEFCON changes
This commit is contained in:
		
							parent
							
								
									158156a866
								
							
						
					
					
						commit
						d3814f8892
					
				
							
								
								
									
										17
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								index.js
									
									
									
									
									
								
							| 
						 | 
					@ -341,7 +341,22 @@ client.on('interactionCreate', async interaction => {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			updateDefcon(level);
 | 
								updateDefcon(level);
 | 
				
			||||||
 | 
								// Send automated announcement.
 | 
				
			||||||
 | 
								color = parseInt(config.DEFCON.levels[defcon].color.replace("#", ""), 16);
 | 
				
			||||||
 | 
								client.channels.cache.get(config.discord.announcement_channel).send({
 | 
				
			||||||
 | 
									content: config.discord.announcment_content,
 | 
				
			||||||
 | 
									embeds: [
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											color,
 | 
				
			||||||
 | 
											title: `We are now at DEFCON ${defcon}`,
 | 
				
			||||||
 | 
											description: config.DEFCON.levels[defcon].message,
 | 
				
			||||||
 | 
											footer: {
 | 
				
			||||||
 | 
												text: `Updated by ${interaction.user.displayName} at`
 | 
				
			||||||
 | 
											},
 | 
				
			||||||
 | 
											timestamp: new Date()
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									]
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
			// Send response
 | 
								// Send response
 | 
				
			||||||
			interaction.reply({ content: `Successfully set DEFCON level to ${level}.`, ephemeral: true });
 | 
								interaction.reply({ content: `Successfully set DEFCON level to ${level}.`, ephemeral: true });
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue