Fix lint...

This commit is contained in:
DjDeveloperr 2020-11-08 13:27:24 +05:30
parent 70824135a7
commit 04f2912c3c
33 changed files with 100 additions and 100 deletions

View file

@ -1,5 +1,5 @@
import { Channel } from '../../structures/channel.ts' import { Channel } from '../../structures/channel.ts'
import { Guild } from "../../structures/guild.ts" import { Guild } from '../../structures/guild.ts'
import { ChannelPayload, GuildChannelPayload } from '../../types/channel.ts' import { ChannelPayload, GuildChannelPayload } from '../../types/channel.ts'
import getChannelByType from '../../utils/getChannelByType.ts' import getChannelByType from '../../utils/getChannelByType.ts'
import { Gateway, GatewayEventHandler } from '../index.ts' import { Gateway, GatewayEventHandler } from '../index.ts'

View file

@ -1,10 +1,10 @@
import { Gateway, GatewayEventHandler } from '../index.ts' import { Gateway, GatewayEventHandler } from '../index.ts'
import { Guild } from '../../structures/guild.ts' import { Guild } from '../../structures/guild.ts'
import { GuildPayload, MemberPayload } from "../../types/guild.ts" import { GuildPayload, MemberPayload } from '../../types/guild.ts'
import { MembersManager } from "../../managers/members.ts" import { MembersManager } from '../../managers/members.ts'
import { GuildChannelPayload } from "../../types/channel.ts" import { GuildChannelPayload } from '../../types/channel.ts'
import { RolePayload } from "../../types/role.ts" import { RolePayload } from '../../types/role.ts'
import { RolesManager } from "../../managers/roles.ts" import { RolesManager } from '../../managers/roles.ts'
export const guildCreate: GatewayEventHandler = async(gateway: Gateway, d: GuildPayload) => { export const guildCreate: GatewayEventHandler = async(gateway: Gateway, d: GuildPayload) => {
let guild: Guild | undefined = await gateway.client.guilds.get(d.id) let guild: Guild | undefined = await gateway.client.guilds.get(d.id)

View file

@ -10,8 +10,8 @@ import { guildUpdate } from './guildUpdate.ts'
import { guildBanAdd } from './guildBanAdd.ts' import { guildBanAdd } from './guildBanAdd.ts'
import { ready } from './ready.ts' import { ready } from './ready.ts'
import { guildBanRemove } from './guildBanRemove.ts' import { guildBanRemove } from './guildBanRemove.ts'
import { messageCreate } from "./messageCreate.ts" import { messageCreate } from './messageCreate.ts'
import { resume } from "./resume.ts" import { resume } from './resume.ts'
import { reconnect } from './reconnect.ts' import { reconnect } from './reconnect.ts'
export const gatewayHandlers: { export const gatewayHandlers: {

View file

@ -31,9 +31,9 @@ export const messageCreate: GatewayEventHandler = async (
message.member = member message.member = member
if (guild !== undefined) message.guild = guild if (guild !== undefined) message.guild = guild
if (message.member !== undefined) { if (message.member !== undefined) {
if(message.member.user === undefined) { if (message.member.user === undefined) {
const user = await gateway.client.users.get(message.member.id) const user = await gateway.client.users.get(message.member.id)
if(user !== undefined) { if (user !== undefined) {
message.member.user = user message.member.user = user
} }
} }

View file

@ -1,4 +1,4 @@
import { Gateway , GatewayEventHandler } from "../index.ts" import { Gateway , GatewayEventHandler } from '../index.ts'
export const reconnect: GatewayEventHandler = async (gateway: Gateway, d: any) => { export const reconnect: GatewayEventHandler = async (gateway: Gateway, d: any) => {
gateway.reconnect() gateway.reconnect()

View file

@ -1,5 +1,5 @@
import { User } from "../../structures/user.ts" import { User } from '../../structures/user.ts'
import { CLIENT_USER } from "../../types/endpoint.ts" import { CLIENT_USER } from '../../types/endpoint.ts'
import { Gateway, GatewayEventHandler } from '../index.ts' import { Gateway, GatewayEventHandler } from '../index.ts'
export const resume: GatewayEventHandler = async (gateway: Gateway, d: any) => { export const resume: GatewayEventHandler = async (gateway: Gateway, d: any) => {

View file

@ -12,8 +12,8 @@ import {
} from '../types/gateway.ts' } from '../types/gateway.ts'
import { gatewayHandlers } from './handlers/index.ts' import { gatewayHandlers } from './handlers/index.ts'
import { GATEWAY_BOT } from '../types/endpoint.ts' import { GATEWAY_BOT } from '../types/endpoint.ts'
import { GatewayCache } from "../managers/gatewayCache.ts" import { GatewayCache } from '../managers/gatewayCache.ts'
import { ClientActivityPayload } from "../structures/presence.ts" import { ClientActivityPayload } from '../structures/presence.ts'
/** /**
* Handles Discord gateway connection. * Handles Discord gateway connection.

View file

@ -1,5 +1,5 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Collection } from "../utils/collection.ts"; import { Collection } from '../utils/collection.ts'
export class BaseManager<T, T2> { export class BaseManager<T, T2> {
client: Client client: Client

View file

@ -1,6 +1,6 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Collection } from "../utils/collection.ts"; import { Collection } from '../utils/collection.ts'
import { BaseManager } from "./base.ts"; import { BaseManager } from './base.ts'
export class BaseChildManager<T, T2> { export class BaseChildManager<T, T2> {
client: Client client: Client

View file

@ -1,9 +1,9 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Channel } from "../structures/channel.ts"; import { Channel } from '../structures/channel.ts'
import { ChannelPayload } from "../types/channel.ts"; import { ChannelPayload } from '../types/channel.ts'
import { CHANNEL } from "../types/endpoint.ts"; import { CHANNEL } from '../types/endpoint.ts'
import getChannelByType from "../utils/getChannelByType.ts"; import getChannelByType from '../utils/getChannelByType.ts'
import { BaseManager } from "./base.ts"; import { BaseManager } from './base.ts'
export class ChannelsManager extends BaseManager<ChannelPayload, Channel> { export class ChannelsManager extends BaseManager<ChannelPayload, Channel> {
constructor(client: Client) { constructor(client: Client) {

View file

@ -1,13 +1,13 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Channel } from "../structures/channel.ts"; import { Channel } from '../structures/channel.ts'
import { Guild } from "../structures/guild.ts"; import { Guild } from '../structures/guild.ts'
import { CategoryChannel } from "../structures/guildCategoryChannel.ts"; import { CategoryChannel } from '../structures/guildCategoryChannel.ts'
import { GuildTextChannel } from "../structures/guildTextChannel.ts"; import { GuildTextChannel } from '../structures/guildTextChannel.ts'
import { VoiceChannel } from "../structures/guildVoiceChannel.ts"; import { VoiceChannel } from '../structures/guildVoiceChannel.ts'
import { GuildChannelCategoryPayload, GuildTextChannelPayload, GuildVoiceChannelPayload } from "../types/channel.ts"; import { GuildChannelCategoryPayload, GuildTextChannelPayload, GuildVoiceChannelPayload } from '../types/channel.ts'
import { CHANNEL } from "../types/endpoint.ts"; import { CHANNEL } from '../types/endpoint.ts'
import { BaseChildManager } from "./baseChild.ts"; import { BaseChildManager } from './baseChild.ts'
import { ChannelsManager } from "./channels.ts"; import { ChannelsManager } from './channels.ts'
export type GuildChannelPayloads = GuildTextChannelPayload | GuildVoiceChannelPayload | GuildChannelCategoryPayload export type GuildChannelPayloads = GuildTextChannelPayload | GuildVoiceChannelPayload | GuildChannelCategoryPayload
export type GuildChannel = GuildTextChannel | VoiceChannel | CategoryChannel export type GuildChannel = GuildTextChannel | VoiceChannel | CategoryChannel

View file

@ -1,9 +1,9 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Guild } from "../structures/guild.ts"; import { Guild } from '../structures/guild.ts'
import { GUILD } from "../types/endpoint.ts"; import { GUILD } from '../types/endpoint.ts'
import { GuildPayload, MemberPayload } from "../types/guild.ts"; import { GuildPayload, MemberPayload } from '../types/guild.ts'
import { BaseManager } from "./base.ts"; import { BaseManager } from './base.ts'
import { MembersManager } from "./members.ts"; import { MembersManager } from './members.ts'
export class GuildManager extends BaseManager<GuildPayload, Guild> { export class GuildManager extends BaseManager<GuildPayload, Guild> {
constructor (client: Client) { constructor (client: Client) {

View file

@ -1,10 +1,10 @@
import { User } from "../structures/user.ts"; import { User } from '../structures/user.ts'
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Guild } from "../structures/guild.ts"; import { Guild } from '../structures/guild.ts'
import { Member } from "../structures/member.ts"; import { Member } from '../structures/member.ts'
import { GUILD_MEMBER } from "../types/endpoint.ts"; import { GUILD_MEMBER } from '../types/endpoint.ts'
import { MemberPayload } from "../types/guild.ts"; import { MemberPayload } from '../types/guild.ts'
import { BaseManager } from "./base.ts"; import { BaseManager } from './base.ts'
export class MembersManager extends BaseManager<MemberPayload, Member> { export class MembersManager extends BaseManager<MemberPayload, Member> {
guild: Guild guild: Guild
@ -21,7 +21,7 @@ export class MembersManager extends BaseManager<MemberPayload, Member> {
const res = new this.DataType(this.client, raw, user) const res = new this.DataType(this.client, raw, user)
for (const roleid of res.roleIDs as string[]) { for (const roleid of res.roleIDs as string[]) {
const role = await this.guild.roles.get(roleid) const role = await this.guild.roles.get(roleid)
if(role !== undefined) res.roles.push(role) if (role !== undefined) res.roles.push(role)
} }
return res return res
} }
@ -34,7 +34,7 @@ export class MembersManager extends BaseManager<MemberPayload, Member> {
const res = new Member(this.client, data as MemberPayload, user) const res = new Member(this.client, data as MemberPayload, user)
for (const roleid of res.roleIDs as string[]) { for (const roleid of res.roleIDs as string[]) {
const role = await this.guild.roles.get(roleid) const role = await this.guild.roles.get(roleid)
if(role !== undefined) res.roles.push(role) if (role !== undefined) res.roles.push(role)
} }
resolve(res) resolve(res)
}).catch(e => reject(e)) }).catch(e => reject(e))

View file

@ -1,11 +1,11 @@
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
import { Message } from "../structures/message.ts"; import { Message } from '../structures/message.ts'
import { MessageMentions } from "../structures/messageMentions.ts"; import { MessageMentions } from '../structures/messageMentions.ts'
import { TextChannel } from "../structures/textChannel.ts"; import { TextChannel } from '../structures/textChannel.ts'
import { User } from "../structures/user.ts"; import { User } from '../structures/user.ts'
import { MessagePayload } from "../types/channel.ts"; import { MessagePayload } from '../types/channel.ts'
import { CHANNEL_MESSAGE } from "../types/endpoint.ts"; import { CHANNEL_MESSAGE } from '../types/endpoint.ts'
import { BaseManager } from "./base.ts"; import { BaseManager } from './base.ts'
export class MessagesManager extends BaseManager<MessagePayload, Message> { export class MessagesManager extends BaseManager<MessagePayload, Message> {
constructor (client: Client) { constructor (client: Client) {

View file

@ -3,13 +3,13 @@ import { GatewayIntents } from '../types/gateway.ts'
import { Gateway } from '../gateway/index.ts' import { Gateway } from '../gateway/index.ts'
import { RESTManager } from './rest.ts' import { RESTManager } from './rest.ts'
import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts' import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts'
import { DefaultCacheAdapter, ICacheAdapter } from "./cacheAdapter.ts" import { DefaultCacheAdapter, ICacheAdapter } from './cacheAdapter.ts'
import { UserManager } from "../managers/users.ts" import { UserManager } from '../managers/users.ts'
import { GuildManager } from "../managers/guilds.ts" import { GuildManager } from '../managers/guilds.ts'
import { EmojisManager } from "../managers/emojis.ts" import { EmojisManager } from '../managers/emojis.ts'
import { ChannelsManager } from "../managers/channels.ts" import { ChannelsManager } from '../managers/channels.ts'
import { MessagesManager } from "../managers/messages.ts" import { MessagesManager } from '../managers/messages.ts'
import { ActivityGame, ClientActivity, ClientPresence } from "../structures/presence.ts" import { ActivityGame, ClientActivity, ClientPresence } from '../structures/presence.ts'
/** Some Client Options to modify behaviour */ /** Some Client Options to modify behaviour */
export interface ClientOptions { export interface ClientOptions {

View file

@ -1,8 +1,8 @@
import { Message } from "../structures/message.ts" import { Message } from '../structures/message.ts'
import { TextChannel } from "../structures/textChannel.ts" import { TextChannel } from '../structures/textChannel.ts'
import { User } from "../structures/user.ts" import { User } from '../structures/user.ts'
import { Collection } from "../utils/collection.ts" import { Collection } from '../utils/collection.ts'
import { CommandClient } from "./commandClient.ts" import { CommandClient } from './commandClient.ts'
export interface CommandContext { export interface CommandContext {
/** The Client object */ /** The Client object */

View file

@ -1,7 +1,7 @@
import { delay } from '../utils/index.ts' import { delay } from '../utils/index.ts'
import * as baseEndpoints from '../consts/urlsAndVersions.ts' import * as baseEndpoints from '../consts/urlsAndVersions.ts'
import { Client } from './client.ts' import { Client } from './client.ts'
import { getBuildInfo } from "../utils/buildInfo.ts" import { getBuildInfo } from '../utils/buildInfo.ts'
export enum HttpResponseCode { export enum HttpResponseCode {
Ok = 200, Ok = 200,

View file

@ -4,9 +4,9 @@ import { PresenceUpdatePayload } from '../types/gateway.ts'
import { Base } from './base.ts' import { Base } from './base.ts'
import { Emoji } from './emoji.ts' import { Emoji } from './emoji.ts'
import { VoiceState } from './voiceState.ts' import { VoiceState } from './voiceState.ts'
import { RolesManager } from "../managers/roles.ts" import { RolesManager } from '../managers/roles.ts'
import { GuildChannelsManager } from "../managers/guildChannels.ts" import { GuildChannelsManager } from '../managers/guildChannels.ts'
import { MembersManager } from "../managers/members.ts" import { MembersManager } from '../managers/members.ts'
export class Guild extends Base { export class Guild extends Base {
id: string id: string

View file

@ -4,7 +4,7 @@ import {
GuildChannelCategoryPayload, GuildChannelCategoryPayload,
Overwrite Overwrite
} from '../types/channel.ts' } from '../types/channel.ts'
import { Guild } from "./guild.ts" import { Guild } from './guild.ts'
export class CategoryChannel extends Channel { export class CategoryChannel extends Channel {
guildID: string guildID: string

View file

@ -1,6 +1,6 @@
import { Client } from '../models/client.ts' import { Client } from '../models/client.ts'
import { GuildNewsChannelPayload, Overwrite } from '../types/channel.ts' import { GuildNewsChannelPayload, Overwrite } from '../types/channel.ts'
import { Guild } from "./guild.ts" import { Guild } from './guild.ts'
import { TextChannel } from './textChannel.ts' import { TextChannel } from './textChannel.ts'
export class NewsChannel extends TextChannel { export class NewsChannel extends TextChannel {

View file

@ -1,7 +1,7 @@
import { Client } from '../models/client.ts' import { Client } from '../models/client.ts'
import { GuildTextChannelPayload, Overwrite } from '../types/channel.ts' import { GuildTextChannelPayload, Overwrite } from '../types/channel.ts'
import { TextChannel } from './textChannel.ts' import { TextChannel } from './textChannel.ts'
import { Guild } from "./guild.ts" import { Guild } from './guild.ts'
export class GuildTextChannel extends TextChannel { export class GuildTextChannel extends TextChannel {
guildID: string guildID: string

View file

@ -1,7 +1,7 @@
import { Client } from '../models/client.ts' import { Client } from '../models/client.ts'
import { GuildVoiceChannelPayload, Overwrite } from '../types/channel.ts' import { GuildVoiceChannelPayload, Overwrite } from '../types/channel.ts'
import { Channel } from './channel.ts' import { Channel } from './channel.ts'
import { Guild } from "./guild.ts" import { Guild } from './guild.ts'
export class VoiceChannel extends Channel { export class VoiceChannel extends Channel {
bitrate: string bitrate: string

View file

@ -1,7 +1,7 @@
import { Client } from '../models/client.ts' import { Client } from '../models/client.ts'
import { MemberPayload } from '../types/guild.ts' import { MemberPayload } from '../types/guild.ts'
import { Base } from './base.ts' import { Base } from './base.ts'
import { Role } from "./role.ts" import { Role } from './role.ts'
import { User } from './user.ts' import { User } from './user.ts'
export class Member extends Base { export class Member extends Base {

View file

@ -14,10 +14,10 @@ import { User } from './user.ts'
import { Member } from './member.ts' import { Member } from './member.ts'
import { Embed } from './embed.ts' import { Embed } from './embed.ts'
import { CHANNEL_MESSAGE } from '../types/endpoint.ts' import { CHANNEL_MESSAGE } from '../types/endpoint.ts'
import { MessageMentions } from "./messageMentions.ts" import { MessageMentions } from './messageMentions.ts'
import { TextChannel } from "./textChannel.ts" import { TextChannel } from './textChannel.ts'
import { DMChannel } from "./dmChannel.ts" import { DMChannel } from './dmChannel.ts'
import { Guild } from "./guild.ts" import { Guild } from './guild.ts'
export class Message extends Base { export class Message extends Base {
// eslint-disable-next-line @typescript-eslint/prefer-readonly // eslint-disable-next-line @typescript-eslint/prefer-readonly

View file

@ -2,7 +2,7 @@ import { Client } from '../models/client.ts'
import { MessageOption, TextChannelPayload } from '../types/channel.ts' import { MessageOption, TextChannelPayload } from '../types/channel.ts'
import { CHANNEL_MESSAGE, CHANNEL_MESSAGES } from '../types/endpoint.ts' import { CHANNEL_MESSAGE, CHANNEL_MESSAGES } from '../types/endpoint.ts'
import { Channel } from './channel.ts' import { Channel } from './channel.ts'
import { Embed } from "./embed.ts" import { Embed } from './embed.ts'
import { Message } from './message.ts' import { Message } from './message.ts'
import { MessageMentions } from './messageMentions.ts' import { MessageMentions } from './messageMentions.ts'
@ -27,14 +27,14 @@ export class TextChannel extends Channel {
} }
async send (text?: string | AllMessageOptions, option?: AllMessageOptions): Promise<Message> { async send (text?: string | AllMessageOptions, option?: AllMessageOptions): Promise<Message> {
if(typeof text === "object") { if (typeof text === "object") {
option = text option = text
text = undefined text = undefined
} }
if (text === undefined && option === undefined) { if (text === undefined && option === undefined) {
throw new Error('Either text or option is necessary.') throw new Error('Either text or option is necessary.')
} }
if(option instanceof Embed) option = { if (option instanceof Embed) option = {
embed: option embed: option
} }

View file

@ -1,6 +1,6 @@
import { CommandClient, Intents } from '../../mod.ts'; import { CommandClient, Intents } from '../../mod.ts'
import PingCommand from "./cmds/ping.ts"; import PingCommand from './cmds/ping.ts'
import UserinfoCommand from "./cmds/userinfo.ts"; import UserinfoCommand from './cmds/userinfo.ts'
import { TOKEN } from './config.ts' import { TOKEN } from './config.ts'
const client = new CommandClient({ const client = new CommandClient({

View file

@ -1,5 +1,5 @@
import { Command } from "../../../mod.ts"; import { Command } from '../../../mod.ts'
import { CommandContext } from "../../models/command.ts"; import { CommandContext } from '../../models/command.ts'
export default class PingCommand extends Command { export default class PingCommand extends Command {
name = "ping" name = "ping"

View file

@ -1,4 +1,4 @@
import { Command, Member, CommandContext, Embed } from "../../../mod.ts"; import { Command, Member, CommandContext, Embed } from '../../../mod.ts'
export default class UserinfoCommand extends Command { export default class UserinfoCommand extends Command {
name = "userinfo" name = "userinfo"

View file

@ -1,4 +1,4 @@
import { Client, Intents, GuildTextChannel, Message, ClientPresence, Member, Role, GuildChannel, Embed, Guild } from '../../mod.ts'; import { Client, Intents, GuildTextChannel, Message, ClientPresence, Member, Role, GuildChannel, Embed, Guild } from '../../mod.ts'
import { TOKEN } from './config.ts' import { TOKEN } from './config.ts'
const client = new Client({ const client = new Client({

View file

@ -1,6 +1,6 @@
// https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway // https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway
// https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events // https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
import { StatusType } from "../../mod.ts" import { StatusType } from '../../mod.ts'
import { EmojiPayload } from './emoji.ts' import { EmojiPayload } from './emoji.ts'
import { MemberPayload } from './guild.ts' import { MemberPayload } from './guild.ts'
import { ActivityPayload } from './presence.ts' import { ActivityPayload } from './presence.ts'

View file

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import { Client } from "../models/client.ts"; import { Client } from '../models/client.ts'
export const getBuildInfo = (client: Client): { export const getBuildInfo = (client: Client): {
os: string os: string

View file

@ -14,9 +14,9 @@ import { GroupDMChannel } from '../structures/groupChannel.ts'
import { CategoryChannel } from '../structures/guildCategoryChannel.ts' import { CategoryChannel } from '../structures/guildCategoryChannel.ts'
import { NewsChannel } from '../structures/guildNewsChannel.ts' import { NewsChannel } from '../structures/guildNewsChannel.ts'
import { VoiceChannel } from '../structures/guildVoiceChannel.ts' import { VoiceChannel } from '../structures/guildVoiceChannel.ts'
import { Guild } from "../structures/guild.ts" import { Guild } from '../structures/guild.ts'
import { GuildTextChannel } from "../structures/guildTextChannel.ts" import { GuildTextChannel } from '../structures/guildTextChannel.ts'
import { TextChannel } from "../structures/textChannel.ts" import { TextChannel } from '../structures/textChannel.ts'
const getChannelByType = ( const getChannelByType = (
client: Client, client: Client,

View file

@ -1,4 +1,4 @@
import { GatewayIntents } from "../types/gateway.ts"; import { GatewayIntents } from '../types/gateway.ts'
// eslint-disable-next-line @typescript-eslint/no-extraneous-class // eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class Intents { export class Intents {