Added Simplified Intents, and an example
This commit is contained in:
		
							parent
							
								
									5fa0138063
								
							
						
					
					
						commit
						f6eaa739ab
					
				
					 4 changed files with 117 additions and 43 deletions
				
			
		
							
								
								
									
										39
									
								
								examples/ping.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								examples/ping.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| import { Client, Message, Intents } from '../mod.ts' | ||||
| 
 | ||||
| const client = new Client(); | ||||
| 
 | ||||
| client.on("ready", () => { | ||||
|     console.log(`Logged in as ${client.user?.tag}!`); | ||||
| }); | ||||
| 
 | ||||
| client.on("messageCreate", (msg: Message) => { | ||||
|     if(msg.content === "!ping") { | ||||
|         console.log("Command Used: Ping"); | ||||
|         msg.reply("pong!"); | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| console.log("discord.deno - ping example"); | ||||
| 
 | ||||
| const token = prompt("Input Bot Token:"); | ||||
| if(!token) { | ||||
|     console.log("No token provided"); | ||||
|     Deno.exit(); | ||||
| } | ||||
| 
 | ||||
| const intents = prompt("Input Intents (0 = All, 1 = Presence, 2 = Server Members):"); | ||||
| if(!intents || !["0", "1", "2"].includes(intents)) { | ||||
|     console.log("No intents provided"); | ||||
|     Deno.exit(); | ||||
| } | ||||
| 
 | ||||
| let ints; | ||||
| if(intents == "0") { | ||||
|     ints = Intents.All; | ||||
| } else if(intents == "1") { | ||||
|     ints = Intents.Presence; | ||||
| } else { | ||||
|     ints = Intents.GuildMembers; | ||||
| } | ||||
| 
 | ||||
| client.connect(token, ints); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue