Merge remote-tracking branch 'origin/main' into slash
This commit is contained in:
		
						commit
						df66f4ea3e
					
				
					 13 changed files with 29 additions and 26 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -114,4 +114,7 @@ src/test/config.ts | ||||||
| # macOS is shit xD | # macOS is shit xD | ||||||
| **/.DS_Store | **/.DS_Store | ||||||
| 
 | 
 | ||||||
|  | # Webstorm dont forget this duude :) | ||||||
|  | .idea/ | ||||||
|  | 
 | ||||||
| src/test/music.mp3 | src/test/music.mp3 | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| { | { | ||||||
|   "name": "harmony", |   "name": "harmony", | ||||||
|   "version": "0.9.2", |   "version": "0.9.3", | ||||||
|   "description": "Discord Deno API that is easy to use.", |   "description": "Discord Deno API that is easy to use.", | ||||||
|   "main": "mod.ts", |   "main": "mod.ts", | ||||||
|   "repository": "https://github.com/harmony-org/harmony.git", |   "repository": "https://github.com/harmony-org/harmony.git", | ||||||
|  |  | ||||||
|  | @ -196,7 +196,7 @@ export interface ClientEvents { | ||||||
|   /** |   /** | ||||||
|    * A Guild Member was updated. Nickname changed, role assigned, etc. |    * A Guild Member was updated. Nickname changed, role assigned, etc. | ||||||
|    * @param before Member object before update |    * @param before Member object before update | ||||||
|    * @param after Meber object after update |    * @param after Member object after update | ||||||
|    */ |    */ | ||||||
|   guildMemberUpdate: [before: Member, after: Member] |   guildMemberUpdate: [before: Member, after: Member] | ||||||
|   /** |   /** | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ export class DefaultCacheAdapter implements ICacheAdapter { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Redis Cache Adatper for using Redis as a cache-provider. */ | /** Redis Cache Adapter for using Redis as a cache-provider. */ | ||||||
| export class RedisCacheAdapter implements ICacheAdapter { | export class RedisCacheAdapter implements ICacheAdapter { | ||||||
|   _redis: Promise<Redis> |   _redis: Promise<Redis> | ||||||
|   redis?: Redis |   redis?: Redis | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ export interface CommandContext { | ||||||
|   channel: TextChannel |   channel: TextChannel | ||||||
|   /** Prefix which was used */ |   /** Prefix which was used */ | ||||||
|   prefix: string |   prefix: string | ||||||
|   /** Oject of Command which was used */ |   /** Object of Command which was used */ | ||||||
|   command: Command |   command: Command | ||||||
|   /** Name of Command which was used */ |   /** Name of Command which was used */ | ||||||
|   name: string |   name: string | ||||||
|  |  | ||||||
|  | @ -67,7 +67,7 @@ export class Extension { | ||||||
|   description?: string |   description?: string | ||||||
|   /** Extensions's Commands Manager */ |   /** Extensions's Commands Manager */ | ||||||
|   commands: ExtensionCommands = new ExtensionCommands(this) |   commands: ExtensionCommands = new ExtensionCommands(this) | ||||||
|   /** Sub-Prefix to be used for ALL of Extenion's Commands. */ |   /** Sub-Prefix to be used for ALL of Extension's Commands. */ | ||||||
|   subPrefix?: string |   subPrefix?: string | ||||||
|   /** Events registered by this Extension */ |   /** Events registered by this Extension */ | ||||||
|   events: { [name: string]: (...args: any[]) => {} } = {} |   events: { [name: string]: (...args: any[]) => {} } = {} | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ import { RESTManager } from './rest.ts' | ||||||
| 
 | 
 | ||||||
| // TODO(DjDeveloperr)
 | // TODO(DjDeveloperr)
 | ||||||
| // I'm kinda confused; will continue on this later once
 | // I'm kinda confused; will continue on this later once
 | ||||||
| // Deno namespace in Web Woker is stable!
 | // Deno namespace in Web Worker is stable!
 | ||||||
| export interface ShardManagerOptions { | export interface ShardManagerOptions { | ||||||
|   client: Client | typeof Client |   client: Client | typeof Client | ||||||
|   token?: string |   token?: string | ||||||
|  |  | ||||||
|  | @ -164,7 +164,7 @@ export class Member extends Base { | ||||||
|   /** |   /** | ||||||
|    * Bans the Member. |    * Bans the Member. | ||||||
|    * @param reason Reason for the Ban. |    * @param reason Reason for the Ban. | ||||||
|    * @param deleteMessagesDays Delete Old Messages? If yes, how much days. |    * @param deleteOldMessages Delete Old Messages? If yes, how much days. | ||||||
|    */ |    */ | ||||||
|   async ban(reason?: string, deleteOldMessages?: number): Promise<void> { |   async ban(reason?: string, deleteOldMessages?: number): Promise<void> { | ||||||
|     return this.guild.bans.add(this.id, reason, deleteOldMessages) |     return this.guild.bans.add(this.id, reason, deleteOldMessages) | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ export default class AddEmojiCommand extends Command { | ||||||
|       .then((emoji) => { |       .then((emoji) => { | ||||||
|         if (emoji === undefined) throw new Error('Unknown') |         if (emoji === undefined) throw new Error('Unknown') | ||||||
|         ctx.message.reply( |         ctx.message.reply( | ||||||
|           `Successfuly added emoji ${emoji.toString()} ${emoji.name}!` |           `Successfully added emoji ${emoji.toString()} ${emoji.name}!` | ||||||
|         ) |         ) | ||||||
|       }) |       }) | ||||||
|       .catch((e) => { |       .catch((e) => { | ||||||
|  |  | ||||||
|  | @ -265,7 +265,7 @@ export interface MessageActivity { | ||||||
| export interface MessageApplication { | export interface MessageApplication { | ||||||
|   id: string |   id: string | ||||||
|   cover_image?: string |   cover_image?: string | ||||||
|   desription: string |   description: string | ||||||
|   icon: string | undefined |   icon: string | undefined | ||||||
|   name: string |   name: string | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -24,8 +24,8 @@ const GUILD_INTEGRATION = (guildID: string, integrationID: string): string => | ||||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations/${integrationID}` |   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations/${integrationID}` | ||||||
| const GUILD_INTEGRATIONS = (guildID: string): string => | const GUILD_INTEGRATIONS = (guildID: string): string => | ||||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations` |   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations` | ||||||
| const GUILD_INTEGARTION_SYNC = (guildID: string): string => | const GUILD_INTEGRATIONS_SYNC = (guildID: string): string => | ||||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations?include_appilications=true` |   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/integrations?include_applications=true` | ||||||
| const GUILD_BAN = (guildID: string, userID: string): string => | const GUILD_BAN = (guildID: string, userID: string): string => | ||||||
|   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans/${userID}` |   `${DISCORD_API_URL}/v${DISCORD_API_VERSION}/guilds/${guildID}/bans/${userID}` | ||||||
| const GUILD_BANS = (guildID: string): string => | const GUILD_BANS = (guildID: string): string => | ||||||
|  | @ -229,7 +229,7 @@ export { | ||||||
|   GUILD_ROLES, |   GUILD_ROLES, | ||||||
|   GUILD_INTEGRATION, |   GUILD_INTEGRATION, | ||||||
|   GUILD_INTEGRATIONS, |   GUILD_INTEGRATIONS, | ||||||
|   GUILD_INTEGARTION_SYNC, |   GUILD_INTEGRATIONS_SYNC, | ||||||
|   GUILD_WIDGET_IMAGE, |   GUILD_WIDGET_IMAGE, | ||||||
|   GUILD_BAN, |   GUILD_BAN, | ||||||
|   GUILD_BANS, |   GUILD_BANS, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /** Delay by `ms` miliseconds */ | /** Delay by `ms` milliseconds */ | ||||||
| export const delay = async (ms: number): Promise<true> => | export const delay = async (ms: number): Promise<true> => | ||||||
|   await new Promise((resolve, reject) => { |   await new Promise((resolve, reject) => { | ||||||
|     setTimeout(() => resolve(true), ms) |     setTimeout(() => resolve(true), ms) | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| import { GatewayIntents } from '../types/gateway.ts' | import { GatewayIntents } from '../types/gateway.ts' | ||||||
| 
 | 
 | ||||||
| export type PriviligedIntents = 'GUILD_MEMBERS' | 'GUILD_PRESENCES' | export type PrivilegedIntents = 'GUILD_MEMBERS' | 'GUILD_PRESENCES' | ||||||
| 
 | 
 | ||||||
| /* eslint-disable @typescript-eslint/no-extraneous-class */ | /* eslint-disable @typescript-eslint/no-extraneous-class */ | ||||||
| /** Utility class for handling Gateway Intents */ | /** Utility class for handling Gateway Intents */ | ||||||
| export class Intents { | export class Intents { | ||||||
|   static NonPriviliged: number[] = [ |   static NonPrivileged: number[] = [ | ||||||
|     GatewayIntents.GUILD_MESSAGES, |     GatewayIntents.GUILD_MESSAGES, | ||||||
|     GatewayIntents.DIRECT_MESSAGES, |     GatewayIntents.DIRECT_MESSAGES, | ||||||
|     GatewayIntents.DIRECT_MESSAGE_REACTIONS, |     GatewayIntents.DIRECT_MESSAGE_REACTIONS, | ||||||
|  | @ -24,32 +24,32 @@ export class Intents { | ||||||
|   static All: number[] = [ |   static All: number[] = [ | ||||||
|     GatewayIntents.GUILD_MEMBERS, |     GatewayIntents.GUILD_MEMBERS, | ||||||
|     GatewayIntents.GUILD_PRESENCES, |     GatewayIntents.GUILD_PRESENCES, | ||||||
|     ...Intents.NonPriviliged |     ...Intents.NonPrivileged | ||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
|   static Presence: number[] = [ |   static Presence: number[] = [ | ||||||
|     GatewayIntents.GUILD_PRESENCES, |     GatewayIntents.GUILD_PRESENCES, | ||||||
|     ...Intents.NonPriviliged |     ...Intents.NonPrivileged | ||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
|   static GuildMembers: number[] = [ |   static GuildMembers: number[] = [ | ||||||
|     GatewayIntents.GUILD_MEMBERS, |     GatewayIntents.GUILD_MEMBERS, | ||||||
|     ...Intents.NonPriviliged |     ...Intents.NonPrivileged | ||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
|   static None: number[] = [...Intents.NonPriviliged] |   static None: number[] = [...Intents.NonPrivileged] | ||||||
| 
 | 
 | ||||||
|   /** Create an Array of Intents easily passing Intents you're priviliged for and disable the ones you don't need */ |   /** Create an Array of Intents easily passing Intents you're privileged for and disable the ones you don't need */ | ||||||
|   static create( |   static create( | ||||||
|     priviliged?: PriviligedIntents[], |     privileged?: PrivilegedIntents[], | ||||||
|     disable?: number[] |     disable?: number[] | ||||||
|   ): number[] { |   ): number[] { | ||||||
|     let intents: number[] = [...Intents.NonPriviliged] |     let intents: number[] = [...Intents.NonPrivileged] | ||||||
| 
 | 
 | ||||||
|     if (priviliged !== undefined && priviliged.length !== 0) { |     if (privileged !== undefined && privileged.length !== 0) { | ||||||
|       if (priviliged.includes('GUILD_MEMBERS')) |       if (privileged.includes('GUILD_MEMBERS')) | ||||||
|         intents.push(GatewayIntents.GUILD_MEMBERS) |         intents.push(GatewayIntents.GUILD_MEMBERS) | ||||||
|       if (priviliged.includes('GUILD_PRESENCES')) |       if (privileged.includes('GUILD_PRESENCES')) | ||||||
|         intents.push(GatewayIntents.GUILD_PRESENCES) |         intents.push(GatewayIntents.GUILD_PRESENCES) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue