Skip to content

Commit

Permalink
format files and ready for v0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed Dec 2, 2020
1 parent a80a68b commit 5e5b407
Show file tree
Hide file tree
Showing 112 changed files with 4,478 additions and 4,282 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deno.yml
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
deno: ["v1.x", "nightly"]
deno: ['v1.x', 'nightly']

steps:
- name: Setup repo
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/lint.yml
Expand Up @@ -5,23 +5,22 @@ name: Lint Test

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2.1.2

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
- name: Setup ESLint
run: npm install

- name: Setup ESLint
run: npm install

- name: Test ESLint
run: npx eslint src/
- name: Test ESLint
run: npx eslint src/
4 changes: 3 additions & 1 deletion .prettierrc
Expand Up @@ -2,5 +2,7 @@
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "always"
}
22 changes: 11 additions & 11 deletions .vscode/settings.json
@@ -1,11 +1,11 @@
{
"deno.enable": true,
"deno.lint": false,
"deno.unstable": false,
"deepscan.enable": true,
"deno.import_intellisense_origins": {
"https://deno.land": true
},
"editor.tabSize": 2,
"editor.formatOnSave": true
}
{
"deno.enable": true,
"deno.lint": false,
"deno.unstable": false,
"deepscan.enable": true,
"deno.import_intellisense_origins": {
"https://deno.land": true
},
"editor.tabSize": 2,
"editor.formatOnSave": true
}
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -48,7 +48,7 @@ Here is a small example of how to use harmony,
import {
Client,
Message,
Intents,
Intents
} from 'https://raw.githubusercontent.com/harmony-org/harmony/main/mod.ts'

const client = new Client()
Expand Down Expand Up @@ -78,11 +78,11 @@ import {
Command,
CommandContext,
Message,
Intents,
Intents
} from 'https://raw.githubusercontent.com/harmony-org/harmony/main/mod.ts'

const client = new CommandClient({
prefix: '!',
prefix: '!'
})

// Listen for event when client is ready (Identified through gateway / Resumed)
Expand Down
140 changes: 70 additions & 70 deletions mod.ts
@@ -1,70 +1,70 @@
export * from './src/gateway/index.ts'
export * from './src/models/client.ts'
export * from './src/models/rest.ts'
export * from './src/models/cacheAdapter.ts'
export * from './src/models/shard.ts'
export * from './src/models/command.ts'
export * from './src/models/extensions.ts'
export * from './src/models/commandClient.ts'
export * from './src/managers/base.ts'
export * from './src/managers/baseChild.ts'
export * from './src/managers/channels.ts'
export * from './src/managers/emojis.ts'
export * from './src/managers/gatewayCache.ts'
export * from './src/managers/guildChannels.ts'
export * from './src/managers/guilds.ts'
export * from './src/managers/guildChannels.ts'
export * from './src/managers/guildEmojis.ts'
export * from './src/managers/members.ts'
export * from './src/managers/messageReactions.ts'
export * from './src/managers/reactionUsers.ts'
export * from './src/managers/messages.ts'
export * from './src/managers/roles.ts'
export * from './src/managers/users.ts'
export * from './src/structures/application.ts'
export * from './src/structures/base.ts'
export * from './src/structures/cdn.ts'
export * from './src/structures/channel.ts'
export * from './src/structures/dmChannel.ts'
export * from './src/structures/embed.ts'
export * from './src/structures/emoji.ts'
export * from './src/structures/groupChannel.ts'
export * from './src/structures/guild.ts'
export * from './src/structures/guildCategoryChannel.ts'
export * from './src/structures/guildNewsChannel.ts'
export * from './src/structures/guildVoiceChannel.ts'
export * from './src/structures/invite.ts'
export * from './src/structures/member.ts'
export * from './src/structures/message.ts'
export * from './src/structures/messageMentions.ts'
export * from './src/structures/presence.ts'
export * from './src/structures/role.ts'
export * from './src/structures/snowflake.ts'
export * from './src/structures/textChannel.ts'
export * from './src/structures/messageReaction.ts'
export * from './src/structures/user.ts'
export * from './src/structures/webhook.ts'
export * from './src/types/application.ts'
export * from './src/types/cdn.ts'
export * from './src/types/channel.ts'
export * from './src/types/emoji.ts'
export * from './src/types/endpoint.ts'
export * from './src/types/gateway.ts'
export * from './src/types/gatewayBot.ts'
export * from './src/types/gatewayResponse.ts'
export * from './src/types/guild.ts'
export * from './src/types/invite.ts'
export * from './src/types/permissionFlags.ts'
export * from './src/types/presence.ts'
export * from './src/types/role.ts'
export * from './src/types/template.ts'
export * from './src/types/user.ts'
export * from './src/types/voice.ts'
export * from './src/types/webhook.ts'
export * from './src/utils/collection.ts'
export * from './src/utils/intents.ts'
export * from './src/utils/buildInfo.ts'
export * from './src/utils/permissions.ts'
export * from './src/utils/userFlags.ts'
export * from './src/utils/bitfield.ts'
export * from './src/utils/getChannelByType.ts'
export * from './src/gateway/index.ts'
export * from './src/models/client.ts'
export * from './src/models/rest.ts'
export * from './src/models/cacheAdapter.ts'
export * from './src/models/shard.ts'
export * from './src/models/command.ts'
export * from './src/models/extensions.ts'
export * from './src/models/commandClient.ts'
export * from './src/managers/base.ts'
export * from './src/managers/baseChild.ts'
export * from './src/managers/channels.ts'
export * from './src/managers/emojis.ts'
export * from './src/managers/gatewayCache.ts'
export * from './src/managers/guildChannels.ts'
export * from './src/managers/guilds.ts'
export * from './src/managers/guildChannels.ts'
export * from './src/managers/guildEmojis.ts'
export * from './src/managers/members.ts'
export * from './src/managers/messageReactions.ts'
export * from './src/managers/reactionUsers.ts'
export * from './src/managers/messages.ts'
export * from './src/managers/roles.ts'
export * from './src/managers/users.ts'
export * from './src/structures/application.ts'
export * from './src/structures/base.ts'
export * from './src/structures/cdn.ts'
export * from './src/structures/channel.ts'
export * from './src/structures/dmChannel.ts'
export * from './src/structures/embed.ts'
export * from './src/structures/emoji.ts'
export * from './src/structures/groupChannel.ts'
export * from './src/structures/guild.ts'
export * from './src/structures/guildCategoryChannel.ts'
export * from './src/structures/guildNewsChannel.ts'
export * from './src/structures/guildVoiceChannel.ts'
export * from './src/structures/invite.ts'
export * from './src/structures/member.ts'
export * from './src/structures/message.ts'
export * from './src/structures/messageMentions.ts'
export * from './src/structures/presence.ts'
export * from './src/structures/role.ts'
export * from './src/structures/snowflake.ts'
export * from './src/structures/textChannel.ts'
export * from './src/structures/messageReaction.ts'
export * from './src/structures/user.ts'
export * from './src/structures/webhook.ts'
export * from './src/types/application.ts'
export * from './src/types/cdn.ts'
export * from './src/types/channel.ts'
export * from './src/types/emoji.ts'
export * from './src/types/endpoint.ts'
export * from './src/types/gateway.ts'
export * from './src/types/gatewayBot.ts'
export * from './src/types/gatewayResponse.ts'
export * from './src/types/guild.ts'
export * from './src/types/invite.ts'
export * from './src/types/permissionFlags.ts'
export * from './src/types/presence.ts'
export * from './src/types/role.ts'
export * from './src/types/template.ts'
export * from './src/types/user.ts'
export * from './src/types/voice.ts'
export * from './src/types/webhook.ts'
export * from './src/utils/collection.ts'
export * from './src/utils/intents.ts'
export * from './src/utils/buildInfo.ts'
export * from './src/utils/permissions.ts'
export * from './src/utils/userFlags.ts'
export * from './src/utils/bitfield.ts'
export * from './src/utils/getChannelByType.ts'
18 changes: 9 additions & 9 deletions src/consts/urlsAndVersions.ts
@@ -1,9 +1,9 @@
export const DISCORD_API_URL: string = 'https://discord.com/api'

export const DISCORD_GATEWAY_URL: string = 'wss://gateway.discord.gg'

export const DISCORD_CDN_URL: string = 'https://cdn.discordapp.com'

export const DISCORD_API_VERSION: number = 8

export const DISCORD_VOICE_VERSION: number = 4
export const DISCORD_API_URL: string = 'https://discord.com/api'

export const DISCORD_GATEWAY_URL: string = 'wss://gateway.discord.gg'

export const DISCORD_CDN_URL: string = 'https://cdn.discordapp.com'

export const DISCORD_API_VERSION: number = 8

export const DISCORD_VOICE_VERSION: number = 4
26 changes: 13 additions & 13 deletions src/gateway/handlers/channelDelete.ts
@@ -1,13 +1,13 @@
import { Gateway, GatewayEventHandler } from '../index.ts'
import { ChannelPayload } from '../../types/channel.ts'

export const channelDelete: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPayload
) => {
const channel = await gateway.client.channels.get(d.id)
if (channel !== undefined) {
await gateway.client.channels.delete(d.id)
gateway.client.emit('channelDelete', channel)
}
}
import { Gateway, GatewayEventHandler } from '../index.ts'
import { ChannelPayload } from '../../types/channel.ts'

export const channelDelete: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPayload
) => {
const channel = await gateway.client.channels.get(d.id)
if (channel !== undefined) {
await gateway.client.channels.delete(d.id)
gateway.client.emit('channelDelete', channel)
}
}
46 changes: 23 additions & 23 deletions src/gateway/handlers/channelPinsUpdate.ts
@@ -1,23 +1,23 @@
import { Gateway, GatewayEventHandler } from '../index.ts'
import { TextChannel } from '../../structures/textChannel.ts'
import { ChannelPinsUpdatePayload } from '../../types/gateway.ts'

export const channelPinsUpdate: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPinsUpdatePayload
) => {
const after:
| TextChannel
| undefined = await gateway.client.channels.get<TextChannel>(d.channel_id)
if (after !== undefined) {
const before = after.refreshFromData({
last_pin_timestamp: d.last_pin_timestamp,
})
const raw = await gateway.client.channels._get(d.channel_id)
await gateway.client.channels.set(
after.id,
Object.assign(raw, { last_pin_timestamp: d.last_pin_timestamp })
)
gateway.client.emit('channelPinsUpdate', before, after)
}
}
import { Gateway, GatewayEventHandler } from '../index.ts'
import { TextChannel } from '../../structures/textChannel.ts'
import { ChannelPinsUpdatePayload } from '../../types/gateway.ts'

export const channelPinsUpdate: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPinsUpdatePayload
) => {
const after:
| TextChannel
| undefined = await gateway.client.channels.get<TextChannel>(d.channel_id)
if (after !== undefined) {
const before = after.refreshFromData({
last_pin_timestamp: d.last_pin_timestamp
})
const raw = await gateway.client.channels._get(d.channel_id)
await gateway.client.channels.set(
after.id,
Object.assign(raw, { last_pin_timestamp: d.last_pin_timestamp })
)
gateway.client.emit('channelPinsUpdate', before, after)
}
}
44 changes: 22 additions & 22 deletions src/gateway/handlers/channelUpdate.ts
@@ -1,22 +1,22 @@
import { Channel } from '../../structures/channel.ts'
import { ChannelPayload } from '../../types/channel.ts'
import { Gateway, GatewayEventHandler } from '../index.ts'

export const channelUpdate: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPayload
) => {
const oldChannel = await gateway.client.channels.get(d.id)
await gateway.client.channels.set(d.id, d)
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const newChannel = (await gateway.client.channels.get(d.id)) as Channel

if (oldChannel !== undefined) {
// (DjDeveloperr): Already done by ChannelsManager. I'll recheck later
// if ('guild_id' in d) {
// // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
// (newChannel as GuildChannel).guild = await gateway.client.guilds.get((d as GuildChannelPayload).guild_id) as Guild
// }
gateway.client.emit('channelUpdate', oldChannel, newChannel)
} else gateway.client.emit('channelUpdateUncached', newChannel)
}
import { Channel } from '../../structures/channel.ts'
import { ChannelPayload } from '../../types/channel.ts'
import { Gateway, GatewayEventHandler } from '../index.ts'

export const channelUpdate: GatewayEventHandler = async (
gateway: Gateway,
d: ChannelPayload
) => {
const oldChannel = await gateway.client.channels.get(d.id)
await gateway.client.channels.set(d.id, d)
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const newChannel = (await gateway.client.channels.get(d.id)) as Channel

if (oldChannel !== undefined) {
// (DjDeveloperr): Already done by ChannelsManager. I'll recheck later
// if ('guild_id' in d) {
// // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
// (newChannel as GuildChannel).guild = await gateway.client.guilds.get((d as GuildChannelPayload).guild_id) as Guild
// }
gateway.client.emit('channelUpdate', oldChannel, newChannel)
} else gateway.client.emit('channelUpdateUncached', newChannel)
}

0 comments on commit 5e5b407

Please sign in to comment.