mirror of
				https://github.com/keanuplayz/TravBot-v3.git
				synced 2024-08-15 02:33:12 +00:00 
			
		
		
		
	Added poll to fun.
This commit is contained in:
		
							parent
							
								
									ed14ccefca
								
							
						
					
					
						commit
						10f4f30137
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		|  | @ -1,3 +1,4 @@ | ||||||
|  | import { MessageEmbed } from "discord.js"; | ||||||
| import Command from "../core/command"; | import Command from "../core/command"; | ||||||
| import {CommonLibrary} from "../core/lib"; | import {CommonLibrary} from "../core/lib"; | ||||||
| 
 | 
 | ||||||
|  | @ -43,6 +44,28 @@ export default new Command({ | ||||||
| 					$.channel.send(responses[Math.floor(Math.random() * responses.length)] + ` <@${sender.id}>`); | 					$.channel.send(responses[Math.floor(Math.random() * responses.length)] + ` <@${sender.id}>`); | ||||||
| 				} | 				} | ||||||
| 			}) | 			}) | ||||||
|  | 		}), | ||||||
|  | 		poll: new Command({ | ||||||
|  | 			description: "Create a poll.", | ||||||
|  | 			usage: "<question>", | ||||||
|  | 			run: "Please provide a question.", | ||||||
|  | 			any: new Command({ | ||||||
|  | 				description: "Question for the poll.", | ||||||
|  | 				async run($: CommonLibrary): Promise<any> | ||||||
|  | 				{ | ||||||
|  | 					const embed = new MessageEmbed() | ||||||
|  | 						.setAuthor(`Poll created by ${$.message.author.username}`, $.message.guild?.iconURL({ dynamic: true }) ?? undefined) | ||||||
|  | 						.setColor(0xffffff) | ||||||
|  | 						.setFooter("React to vote.") | ||||||
|  | 						.setDescription($.args.join(" ")); | ||||||
|  | 					const msg = await $.channel.send(embed); | ||||||
|  | 					await msg.react("✅"); | ||||||
|  | 					await msg.react("⛔"); | ||||||
|  | 					$.message.delete({ | ||||||
|  | 						timeout: 1000 | ||||||
|  | 					}); | ||||||
|  | 				} | ||||||
|  | 			}) | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue