Fix lint
This commit is contained in:
parent
3a3af635c6
commit
7ead2c2ea6
7 changed files with 15 additions and 15 deletions
|
@ -7,7 +7,7 @@ client.on("ready", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on("messageCreate", (msg: Message) => {
|
client.on("messageCreate", (msg: Message) => {
|
||||||
if(msg.content === "!ping") {
|
if (msg.content === "!ping") {
|
||||||
console.log("Command Used: Ping");
|
console.log("Command Used: Ping");
|
||||||
msg.reply("pong!");
|
msg.reply("pong!");
|
||||||
}
|
}
|
||||||
|
@ -16,23 +16,23 @@ client.on("messageCreate", (msg: Message) => {
|
||||||
console.log("discord.deno - ping example");
|
console.log("discord.deno - ping example");
|
||||||
|
|
||||||
const token = prompt("Input Bot Token:");
|
const token = prompt("Input Bot Token:");
|
||||||
if(!token) {
|
if (!token) {
|
||||||
console.log("No token provided");
|
console.log("No token provided");
|
||||||
Deno.exit();
|
Deno.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
const intents = prompt("Input Intents (0 = All, 1 = Presence, 2 = Server Members, 3 = None):");
|
const intents = prompt("Input Intents (0 = All, 1 = Presence, 2 = Server Members, 3 = None):");
|
||||||
if(!intents || !["0", "1", "2", "3"].includes(intents)) {
|
if (!intents || !["0", "1", "2", "3"].includes(intents)) {
|
||||||
console.log("No intents provided");
|
console.log("No intents provided");
|
||||||
Deno.exit();
|
Deno.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
let ints;
|
let ints;
|
||||||
if(intents == "0") {
|
if (intents == "0") {
|
||||||
ints = Intents.All;
|
ints = Intents.All;
|
||||||
} else if(intents == "1") {
|
} else if (intents == "1") {
|
||||||
ints = Intents.Presence;
|
ints = Intents.Presence;
|
||||||
} else if(intents == "2") {
|
} else if (intents == "2") {
|
||||||
ints = Intents.GuildMembers;
|
ints = Intents.GuildMembers;
|
||||||
} else {
|
} else {
|
||||||
ints = Intents.None;
|
ints = Intents.None;
|
||||||
|
|
|
@ -13,7 +13,7 @@ export const channelUpdate: GatewayEventHandler = async (
|
||||||
if (oldChannel !== undefined) {
|
if (oldChannel !== undefined) {
|
||||||
await gateway.client.channels.set(d.id, d)
|
await gateway.client.channels.set(d.id, d)
|
||||||
let guild: undefined | Guild;
|
let guild: undefined | Guild;
|
||||||
if('guild_id' in d) {
|
if ('guild_id' in d) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
guild = await gateway.client.guilds.get((d as GuildChannelPayload).guild_id) as Guild | undefined
|
guild = await gateway.client.guilds.get((d as GuildChannelPayload).guild_id) as Guild | undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export const messageCreate: GatewayEventHandler = async (
|
||||||
const user = new User(gateway.client, d.author)
|
const user = new User(gateway.client, d.author)
|
||||||
await gateway.client.users.set(d.author.id, d.author)
|
await gateway.client.users.set(d.author.id, d.author)
|
||||||
let guild
|
let guild
|
||||||
if(d.guild_id !== undefined) {
|
if (d.guild_id !== undefined) {
|
||||||
guild = await gateway.client.guilds.get(d.guild_id)
|
guild = await gateway.client.guilds.get(d.guild_id)
|
||||||
}
|
}
|
||||||
const mentions = new MessageMentions()
|
const mentions = new MessageMentions()
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Gateway {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.client.bot === false) {
|
if (this.client.bot === false) {
|
||||||
// TODO: Complete Selfbot support
|
// TODO: Complete Selfbot support
|
||||||
this.debug("Modify Identify Payload for Self-bot..")
|
this.debug("Modify Identify Payload for Self-bot..")
|
||||||
// delete payload.d['intents']
|
// delete payload.d['intents']
|
||||||
|
|
|
@ -182,7 +182,7 @@ export class RESTManager {
|
||||||
method: method.toUpperCase()
|
method: method.toUpperCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.client.bot === false) {
|
if (this.client.bot === false) {
|
||||||
// This is a selfbot. Use requests similar to Discord Client
|
// 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-language'] = 'en-US'
|
||||||
|
@ -252,7 +252,7 @@ export class RESTManager {
|
||||||
let urlToUse =
|
let urlToUse =
|
||||||
method === 'get' && query !== '' ? `${url}?${query}` : url
|
method === 'get' && query !== '' ? `${url}?${query}` : url
|
||||||
|
|
||||||
if(this.client.canary) {
|
if (this.client.canary) {
|
||||||
let split = urlToUse.split('//')
|
let split = urlToUse.split('//')
|
||||||
urlToUse = split[0] + '//canary.' + split[1]
|
urlToUse = split[0] + '//canary.' + split[1]
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ export class RESTManager {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
this.logErrors(response, errorStack)
|
this.logErrors(response, errorStack)
|
||||||
|
|
||||||
if(status === HttpResponseCode.Unauthorized) throw new Error("Request was not successful. Invalid Token.")
|
if (status === HttpResponseCode.Unauthorized) throw new Error("Request was not successful. Invalid Token.")
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case HttpResponseCode.BadRequest:
|
case HttpResponseCode.BadRequest:
|
||||||
|
|
|
@ -88,7 +88,7 @@ export class Message extends Base {
|
||||||
this.flags = data.flags
|
this.flags = data.flags
|
||||||
this.channel = channel
|
this.channel = channel
|
||||||
// TODO: Cache in Gateway Event Code
|
// TODO: Cache in Gateway Event Code
|
||||||
// if(!noSave) this.client.messages.set(this.id, data)
|
// if (!noSave) this.client.messages.set(this.id, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readFromData (data: MessagePayload): void {
|
protected readFromData (data: MessagePayload): void {
|
||||||
|
|
|
@ -14,8 +14,8 @@ export const getBuildInfo = (client: Client) => {
|
||||||
let browser_version = '83.0'
|
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
|
let 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
|
// TODO: Use current OS properties, but also browser_user_agent accordingly
|
||||||
// if(Deno.build.os === 'darwin') os = 'MacOS'
|
// if (Deno.build.os === 'darwin') os = 'MacOS'
|
||||||
// else if(Deno.build.os === 'linux') os = 'Ubuntu'
|
// else if (Deno.build.os === 'linux') os = 'Ubuntu'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
os,
|
os,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue