switch-bots
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,40 @@ | ||
export {}; | ||
import Client from "./client/client"; | ||
import { HandlerType, switchBaseClient } from "./client/baseClient"; | ||
import { WsClient } from "./client/WsClient"; | ||
import { Endpoints } from "./client/endpoints"; | ||
import Message from "./models/message"; | ||
import User, { AuthUser, UserStatus, UserStatusInfo } from "./models/user"; | ||
import Channel from "./models/channel"; | ||
import Group from "./models/group"; | ||
import { Community } from "./models/community"; | ||
import { Command } from "./models/command"; | ||
import { Media, UploadMediaResponse } from "./models/media"; | ||
import { GameInfo } from "./models/game"; | ||
import { Sticker } from "./models/sticker"; | ||
import CallbackQuery from "./models/callbackquery"; | ||
import { CommunityMember } from "./models/community_member"; | ||
import { MemberRoleInfo, Role, RolePermissions } from "./models/role"; | ||
import { Timestamp } from "./models/timestamp"; | ||
import { Button } from "./models/inline_markup"; | ||
import InlineMarkup from "./models/inline_markup"; | ||
import { BotCommand, BotInfo } from "./models/bot"; | ||
import { Organization } from "./models/organization"; | ||
import { OrganizationApp } from "./models/organizationapp"; | ||
export * from "./methods/message"; | ||
export * from "./methods/bot"; | ||
export * from "./methods/community"; | ||
export * from "./methods/channel"; | ||
export * from "./methods/group"; | ||
export * from "./methods/game"; | ||
export * from "./methods/stickers"; | ||
export * from "./methods/media"; | ||
export * from "./methods/callbacks"; | ||
export * from "./methods/organization"; | ||
export * from "./methods/search"; | ||
export * from "./methods/instant_messaging"; | ||
export * from "./methods/restrict"; | ||
export * from "./methods/moderation"; | ||
export * from "./methods/guidelines"; | ||
export { Client, HandlerType, switchBaseClient, WsClient, Endpoints }; | ||
export { Message, User, AuthUser, UserStatus, UserStatusInfo, Channel, Group, Community, Command, Media, UploadMediaResponse, GameInfo, Sticker, CallbackQuery, CommunityMember, MemberRoleInfo, Role, RolePermissions, Timestamp, Button, InlineMarkup, BotCommand, BotInfo, Organization, OrganizationApp }; | ||
export default Client; |
@@ -13,13 +13,4 @@ "use strict"; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -30,52 +21,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const client_1 = __importDefault(require("./switch/client/client")); | ||
const inline_markup_1 = require("./switch/models/inline_markup"); | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const client = new client_1.default("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NjcyMywiaXNfYm90Ijp0cnVlLCJhY3RpdmUiOnRydWUsImlhdCI6MTcwMjkyNzAyNywiZXhwIjoyMzM0MDc5MDI3fQ.wbiJ_XNwCyfdXX8YCojAhLSA8-OttuBJpNwr3oB3yTI"); | ||
// Helper function to convert ReadStream to File | ||
async function streamToFile(filePath) { | ||
const stream = fs.createReadStream(filePath); | ||
const stats = fs.statSync(filePath); | ||
const fileName = path.basename(filePath); | ||
const chunks = []; | ||
for await (const chunk of stream) { | ||
chunks.push(Buffer.from(chunk)); | ||
} | ||
const buffer = Buffer.concat(chunks); | ||
return new File([buffer], fileName, { | ||
type: 'application/octet-stream', | ||
lastModified: stats.mtimeMs | ||
}); | ||
} | ||
client.setBotCommands([ | ||
{ command: "start", description: "hello" }, | ||
{ command: "help", description: "help" }, | ||
]); | ||
// uploadFile().catch(console.error); | ||
client.onCommand("start", async (message) => { | ||
console.log(message); | ||
console.log("command"); | ||
await message.replyText({ | ||
message: "Ji", | ||
inlineMarkup: new inline_markup_1.Button() | ||
.url("Google", "https://livemore.com") | ||
.url("Please", "https://gg.com") | ||
}); | ||
}); | ||
client.onMessage(async (message) => { | ||
console.log(message); | ||
await message.replyText({ message: "Hi" }); | ||
}); | ||
client.onMessage(async (msg) => { | ||
try { | ||
await msg.replyMedia({ | ||
file: await streamToFile("./test.py"), | ||
caption: "test" | ||
}); | ||
} | ||
catch (error) { | ||
console.error("Error sending media:", error); | ||
} | ||
}); | ||
client.start().then(() => console.log("Bot Started!")); | ||
exports.OrganizationApp = exports.Organization = exports.InlineMarkup = exports.Button = exports.CallbackQuery = exports.Media = exports.Command = exports.Community = exports.Group = exports.Channel = exports.UserStatusInfo = exports.Message = exports.Endpoints = exports.WsClient = exports.switchBaseClient = exports.HandlerType = exports.Client = void 0; | ||
const client_1 = __importDefault(require("./client/client")); | ||
exports.Client = client_1.default; | ||
const baseClient_1 = require("./client/baseClient"); | ||
Object.defineProperty(exports, "HandlerType", { enumerable: true, get: function () { return baseClient_1.HandlerType; } }); | ||
Object.defineProperty(exports, "switchBaseClient", { enumerable: true, get: function () { return baseClient_1.switchBaseClient; } }); | ||
const WsClient_1 = require("./client/WsClient"); | ||
Object.defineProperty(exports, "WsClient", { enumerable: true, get: function () { return WsClient_1.WsClient; } }); | ||
const endpoints_1 = require("./client/endpoints"); | ||
Object.defineProperty(exports, "Endpoints", { enumerable: true, get: function () { return endpoints_1.Endpoints; } }); | ||
const message_1 = __importDefault(require("./models/message")); | ||
exports.Message = message_1.default; | ||
const user_1 = require("./models/user"); | ||
Object.defineProperty(exports, "UserStatusInfo", { enumerable: true, get: function () { return user_1.UserStatusInfo; } }); | ||
const channel_1 = __importDefault(require("./models/channel")); | ||
exports.Channel = channel_1.default; | ||
const group_1 = __importDefault(require("./models/group")); | ||
exports.Group = group_1.default; | ||
const community_1 = require("./models/community"); | ||
Object.defineProperty(exports, "Community", { enumerable: true, get: function () { return community_1.Community; } }); | ||
const command_1 = require("./models/command"); | ||
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return command_1.Command; } }); | ||
const media_1 = require("./models/media"); | ||
Object.defineProperty(exports, "Media", { enumerable: true, get: function () { return media_1.Media; } }); | ||
const callbackquery_1 = __importDefault(require("./models/callbackquery")); | ||
exports.CallbackQuery = callbackquery_1.default; | ||
const inline_markup_1 = require("./models/inline_markup"); | ||
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return inline_markup_1.Button; } }); | ||
const inline_markup_2 = __importDefault(require("./models/inline_markup")); | ||
exports.InlineMarkup = inline_markup_2.default; | ||
const organization_1 = require("./models/organization"); | ||
Object.defineProperty(exports, "Organization", { enumerable: true, get: function () { return organization_1.Organization; } }); | ||
const organizationapp_1 = require("./models/organizationapp"); | ||
Object.defineProperty(exports, "OrganizationApp", { enumerable: true, get: function () { return organizationapp_1.OrganizationApp; } }); | ||
__exportStar(require("./methods/message"), exports); | ||
__exportStar(require("./methods/bot"), exports); | ||
__exportStar(require("./methods/community"), exports); | ||
__exportStar(require("./methods/channel"), exports); | ||
__exportStar(require("./methods/group"), exports); | ||
__exportStar(require("./methods/game"), exports); | ||
__exportStar(require("./methods/stickers"), exports); | ||
__exportStar(require("./methods/media"), exports); | ||
__exportStar(require("./methods/callbacks"), exports); | ||
__exportStar(require("./methods/organization"), exports); | ||
__exportStar(require("./methods/search"), exports); | ||
__exportStar(require("./methods/instant_messaging"), exports); | ||
__exportStar(require("./methods/restrict"), exports); | ||
__exportStar(require("./methods/moderation"), exports); | ||
__exportStar(require("./methods/guidelines"), exports); | ||
exports.default = client_1.default; |
{ | ||
"name": "switch-bots", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Switch API TypeScript SDK for building bots and applications", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"start": "ts-node index.ts", | ||
"dev": "ts-node-dev --respawn index.ts", | ||
"clean": "rimraf dist", | ||
"prebuild": "npm run clean", | ||
"prepare": "npm run build", | ||
"test": "jest", | ||
"prepare": "npm run build" | ||
"lint": "eslint 'switch/**/*.ts'", | ||
"format": "prettier --write 'switch/**/*.ts'", | ||
"docs": "typedoc --out docs switch/", | ||
"example": "ts-node example/index.ts" | ||
}, | ||
@@ -42,3 +50,4 @@ "keywords": [ | ||
"dependencies": { | ||
"ws": "^8.13.0" | ||
"ws": "^8.13.0", | ||
"uuid": "^9.0.0" | ||
}, | ||
@@ -48,6 +57,23 @@ "devDependencies": { | ||
"@types/ws": "^8.5.5", | ||
"@types/uuid": "^9.0.0", | ||
"rimraf": "^5.0.0", | ||
"typescript": "^5.0.0", | ||
"ts-node": "^10.9.1", | ||
"ts-node-dev": "^2.0.0", | ||
"typescript": "^5.0.0" | ||
"prettier": "^3.0.0", | ||
"eslint": "^8.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"typedoc": "^0.25.0" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/switchpe/switch-bots.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/switchpe/switch-bots/issues" | ||
}, | ||
"homepage": "https://github.com/switchpe/switch-bots#readme", | ||
"publishConfig": { | ||
@@ -54,0 +80,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
136406
2
11
84
3212
4
+ Addeduuid@^9.0.0
+ Addeduuid@9.0.1(transitive)