Allows you to automate tasks on Snapchat Web
Once calling the function Snapchat.Login
we will boot up all the essentials for the client, if you aren't authenticated we will wait for you to log in to your snapchat account before continuing execution of the program. If authentication exists you should still call this function as it handles events etc
To remove your data delete the
user_data
folder
This contains the exact data returned from the snapchat API on friend information.
Snapchat.friends <array>
Event fires every time a message is sent within the current channel.
Snapchat.events.on("message")
This function initializes and loads up snapchat web, if you already authenticated it won't go through the authentication process.
await Snapchat.Login(<void>) : void
This function closes the current chat active on the browser.
await Snapchat.CloseChat(<void>) : void
This function opens a chat within the browser.
await Snapchat.OpenChat(<string name>) : void
This function returns an array of chat names on your account.
await Snapchat.GetChats(<void>) : [string...]
This function returns an array of all messages within the current channel.
await Snapchat.GetMessages(<void>): [{ author: string, content: string }...]
This function sends a message in the current channel.
await Snapchat.SendMessage(<string message>) : void
const Snapchat = require(".");
(async () => {
const client = await Snapchat.Login();
const chats = await client.GetChats();
await client.OpenChat(chats[0]); // open first chat
// event only fires when a chat is open
client.events.on("message", async (message) => {
console.log(message);
if (message.content === "ping") {
await client.SendMessage("pong!");
}
});
})();