Fix lint (2)
This commit is contained in:
		
							parent
							
								
									7ead2c2ea6
								
							
						
					
					
						commit
						2f560d72e7
					
				
					 6 changed files with 36 additions and 26 deletions
				
			
		|  | @ -16,23 +16,23 @@ client.on("messageCreate", (msg: Message) => { | |||
| console.log("discord.deno - ping example"); | ||||
| 
 | ||||
| const token = prompt("Input Bot Token:"); | ||||
| if (!token) { | ||||
| if (token === null) { | ||||
|     console.log("No token provided"); | ||||
|     Deno.exit(); | ||||
| } | ||||
| 
 | ||||
| const intents = prompt("Input Intents (0 = All, 1 = Presence, 2 = Server Members, 3 = None):"); | ||||
| if (!intents || !["0", "1", "2", "3"].includes(intents)) { | ||||
| if (intents === null || !["0", "1", "2", "3"].includes(intents)) { | ||||
|     console.log("No intents provided"); | ||||
|     Deno.exit(); | ||||
| } | ||||
| 
 | ||||
| let ints; | ||||
| if (intents == "0") { | ||||
| if (intents === "0") { | ||||
|     ints = Intents.All; | ||||
| } else if (intents == "1") { | ||||
| } else if (intents === "1") { | ||||
|     ints = Intents.Presence; | ||||
| } else if (intents == "2") { | ||||
| } else if (intents === "2") { | ||||
|     ints = Intents.GuildMembers; | ||||
| } else { | ||||
|     ints = Intents.None; | ||||
|  |  | |||
|  | @ -213,7 +213,7 @@ class Gateway { | |||
|       } | ||||
|     } | ||||
| 
 | ||||
|     let payload: any = { | ||||
|     const payload: any = { | ||||
|       op: GatewayOpcodes.IDENTIFY, | ||||
|       d: { | ||||
|         token: this.token, | ||||
|  | @ -315,7 +315,7 @@ class Gateway { | |||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   sendHeartbeat() { | ||||
|   sendHeartbeat(): void { | ||||
|     const payload = { | ||||
|       op: GatewayOpcodes.HEARTBEAT, | ||||
|       d: this.sequenceID ?? null | ||||
|  | @ -325,7 +325,7 @@ class Gateway { | |||
|     this.lastPingTimestamp = Date.now() | ||||
|   } | ||||
| 
 | ||||
|   heartbeat() { | ||||
|   heartbeat(): void { | ||||
|     if (this.heartbeatServerResponded) { | ||||
|       this.heartbeatServerResponded = false | ||||
|     } else { | ||||
|  |  | |||
|  | @ -1,5 +1,4 @@ | |||
| import { Collection } from '../utils/collection.ts' | ||||
| import { Client } from './client.ts' | ||||
| import { | ||||
|   connect, | ||||
|   Redis, | ||||
|  |  | |||
|  | @ -176,7 +176,7 @@ export class RESTManager { | |||
|       headers['Content-Type'] = 'application/json' | ||||
|     } | ||||
| 
 | ||||
|     let data: { [name: string]: any } = { | ||||
|     const data: { [name: string]: any } = { | ||||
|       headers, | ||||
|       body: body?.file ?? JSON.stringify(body), | ||||
|       method: method.toUpperCase() | ||||
|  | @ -184,18 +184,18 @@ export class RESTManager { | |||
| 
 | ||||
|     if (this.client.bot === false) { | ||||
|       // This is a selfbot. Use requests similar to Discord Client
 | ||||
|       data.headers['authorization'] = this.client.token as string | ||||
|       data.headers.authorization = this.client.token as string | ||||
|       data.headers['accept-language'] = 'en-US' | ||||
|       data.headers['accept'] = '*/*' | ||||
|       data.headers.accept = '*/*' | ||||
|       data.headers['sec-fetch-dest'] = 'empty' | ||||
|       data.headers['sec-fetch-mode'] = 'cors' | ||||
|       data.headers['sec-fetch-site'] = 'same-origin' | ||||
|       data.headers['x-super-properties'] = btoa(JSON.stringify(getBuildInfo(this.client))) | ||||
|       delete data.headers['User-Agent'] | ||||
|       delete data.headers['Authorization'] | ||||
|       headers['credentials'] = 'include' | ||||
|       headers['mode'] = 'cors' | ||||
|       headers['referrerPolicy'] = 'no-referrer-when-downgrade' | ||||
|       delete data.headers.Authorization | ||||
|       headers.credentials = 'include' | ||||
|       headers.mode = 'cors' | ||||
|       headers.referrerPolicy = 'no-referrer-when-downgrade' | ||||
|     } | ||||
| 
 | ||||
|     return data | ||||
|  | @ -252,8 +252,8 @@ export class RESTManager { | |||
|           let urlToUse = | ||||
|             method === 'get' && query !== '' ? `${url}?${query}` : url | ||||
| 
 | ||||
|           if (this.client.canary) { | ||||
|             let split = urlToUse.split('//') | ||||
|           if (this.client.canary === true) { | ||||
|             const split = urlToUse.split('//') | ||||
|             urlToUse = split[0] + '//canary.' + split[1] | ||||
|           } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,18 +1,28 @@ | |||
| /* eslint-disable @typescript-eslint/naming-convention */ | ||||
| import { Client } from "../models/client.ts"; | ||||
| 
 | ||||
| export const getBuildInfo = (client: Client) => { | ||||
|     let os = 'Windows' | ||||
|     let os_version = '10' | ||||
| export const getBuildInfo = (client: Client): { | ||||
|     os: string | ||||
|     os_version: string | ||||
|     browser: string | ||||
|     browser_version: string | ||||
|     browser_user_agent: string | ||||
|     client_build_number: number | ||||
|     client_event_source: null | ||||
|     release_channel: string | ||||
| } => { | ||||
|     const os = 'Windows' | ||||
|     const os_version = '10' | ||||
|     let client_build_number = 71073 | ||||
|     let client_event_source = null | ||||
|     const client_event_source = null | ||||
|     let release_channel = 'stable' | ||||
|     if (client.canary) { | ||||
|     if (client.canary === true) { | ||||
|         release_channel = 'canary' | ||||
|         client_build_number = 71076 | ||||
|     } | ||||
|     let browser = 'Firefox' | ||||
|     let browser_version = '83.0' | ||||
|     let browser_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 ' + browser + '/' + browser_version | ||||
|     const browser = 'Firefox' | ||||
|     const browser_version = '83.0' | ||||
|     const browser_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 ' + browser + '/' + browser_version | ||||
|     // TODO: Use current OS properties, but also browser_user_agent accordingly
 | ||||
|     // if (Deno.build.os === 'darwin') os = 'MacOS'
 | ||||
|     // else if (Deno.build.os === 'linux') os = 'Ubuntu'
 | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| import { GatewayIntents } from "../types/gateway.ts"; | ||||
| 
 | ||||
| // eslint-disable-next-line @typescript-eslint/no-extraneous-class
 | ||||
| export class Intents { | ||||
|   static All: number[] = [ | ||||
|     GatewayIntents.GUILD_MEMBERS, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue