calico-crusade / palringoapi-ts

TypeScript/JavaScript PalringoAPI
3 stars 1 forks source link

how can i send a group message? #1

Closed paluser closed 4 years ago

paluser commented 4 years ago

i install : npm i palringo-ts -d then in my js file write:

var pal = require('palringo-ts'); var bot = pal.PalBot(); var client = pal.Client; bot.On.LoginSuccess = function (user) { console.log('User logged in: ', user); }; bot.On.LoginFailed = function (reason) { console.log('Login Failed: ', reason); }; bot.login('email', 'password');

bot.groupMessage(18134470,'hello world') //this line not work client.prototype.messaging.groupMessage(18134470,'hello world') //this line not work also

So how can i send a group message?

calico-crusade commented 4 years ago

There are examples: https://github.com/calico-crusade/palringoapi-ts/blob/master/example/src/Test.ts

You need to make sure your email and password are correct.

calico-crusade commented 4 years ago

I tested it with the latest release of the package and the following code is working as expected:

var pal = require('palringo-ts');

var email = ""; //Put your bot's email address here
var password = ""; //Put your bot's password here

var bot = pal.PalBot();

bot.On.LoginSuccess = function (user) { console.log('User logged in: ', user); };
bot.On.LoginFailed = function (reason) { console.log('Login Failed: ', reason); };
bot.On.GroupMessage = function(message) {
    bot.groupMessage(message.group.id, 'hello world');
};

bot.login(email, password);

image

calico-crusade commented 4 years ago

I'm closing this due to lack of a response. If it is still a problem, please let me know.