Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d97abc00e2 | |||
| cada5487bf | |||
| 2f9c65512b | |||
| edd87375c3 | |||
| b2d5b84435 | |||
| c460dc5385 | |||
| f54e76ab72 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@chatenium/chatenium-sdk",
|
||||
"version": "1.1.10",
|
||||
"version": "1.2.0",
|
||||
"description": "A library for interacting with the Chatenium API",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
32
src/core/permissions.ts
Normal file
32
src/core/permissions.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export const permissions = {
|
||||
createAndEditCategories: 2,
|
||||
deleteCategories: 4,
|
||||
createAndEditChannels: 8,
|
||||
deleteChannels: 16,
|
||||
deleteAnyMessage: 32,
|
||||
pinMessages: 64,
|
||||
createAndEditRanks: 128,
|
||||
deleteRanks: 256,
|
||||
changeNetworkNamePictureAndVisibility: 512,
|
||||
createEmojis: 1024,
|
||||
deleteEmojis: 2048,
|
||||
manageEmbed: 4096,
|
||||
createWebhooks: 8192,
|
||||
deleteWebhooks: 16384,
|
||||
createInvites: 32768,
|
||||
deleteInvites: 65536,
|
||||
sendMessages: 131072,
|
||||
seeChannels: 262144,
|
||||
banMembers: 524288,
|
||||
kickMembers: 1048576,
|
||||
unAndAssignRanksToMember: 2097152,
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the set of permissions includes the permission. Note that network owners have regular permissions just like the other members, so if the userid matches with the network's creator ID, then the permission is automatically granted. This logic is not included in this function.
|
||||
* @param permissions
|
||||
* @param permission
|
||||
*/
|
||||
export function permissionGranted(permissions: number, permission: number): Boolean {
|
||||
return (permissions & permission) === permission;
|
||||
}
|
||||
@@ -24,5 +24,5 @@ export interface Attachment {
|
||||
path: string
|
||||
height: number
|
||||
width: number
|
||||
extraMetaData: Record<string, string> // Used by clients
|
||||
extraMetaData: Record<string, any> // Used by clients
|
||||
}
|
||||
@@ -208,9 +208,11 @@ export interface GetMembersReq {
|
||||
}
|
||||
|
||||
export interface UploadNewPictureReq {
|
||||
picId: string
|
||||
userid: string
|
||||
networkId: string
|
||||
data: string
|
||||
isImage: boolean
|
||||
monogramColors: RGB | null
|
||||
}
|
||||
|
||||
export interface ChangeVisibilityReq {
|
||||
|
||||
@@ -711,14 +711,18 @@ export class NetworkService {
|
||||
|
||||
/**
|
||||
* Uploads a new network picture
|
||||
* @param picId
|
||||
* @param isImage
|
||||
* @param image
|
||||
* @param colors
|
||||
*/
|
||||
async uploadNewPic(picId: string): Promise<void> {
|
||||
async uploadNewPic(isImage: boolean, image: string | null, colors: RGB | null): Promise<void> {
|
||||
try {
|
||||
await this.client.patch<PublicUserData[]>("network/uploadNewPic", <UploadNewPictureReq>{
|
||||
await this.client.patch<PublicUserData[]>("v2/network/uploadNewPic", <UploadNewPictureReq>{
|
||||
userid: this.userid,
|
||||
networkId: this.networkId,
|
||||
picId: picId,
|
||||
data: image,
|
||||
isImage: isImage,
|
||||
monogramColors: colors
|
||||
});
|
||||
return
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user