//postMessageToChannel(name, message [, params, callback]) (return: promise) - posts a message to channel by name.
bot.postMessageToChannel(data.channels[i].name,'Have some fun with @Joker!\nFor commands write @joker --help'
,emoji.emojis('bowtie'));
}
returndata;
...
...
@@ -32,10 +36,11 @@ exports.startbot = ()=>{
bot.on('error',(err)=>console.log(err));
//Message Handler
bot.on('message',(data)=>{
bot.on('message',(data)=>{
if(data.type!=='message'){
return;
}
status=data;
message_recieved=0;
...
...
@@ -96,7 +101,7 @@ function handleMessage(message, current_channel){
elseif(message.includes(' programming')){
programmingJoke(current_channel);
}
elseif(message.includes(' reddit')){
elseif(message.includes(' reddit')){;
redditJoke(current_channel);
}
elseif(message.includes(' funny story')){
...
...
@@ -106,6 +111,9 @@ function handleMessage(message, current_channel){
comment="Please use @joker --help to know what I can do!:smile::smile::smile:\n You can write type of joke[knock-knock, general, programming, funny story, reddit]";
bot.postMessageToChannel(current_channel,"Tell you what??? :no_mouth:",emoji.emojis('no_mouth'));
{"table":[{"id":1,"type":"users","setup":"hello","punchling":" hi"},{"id":2,"type":"users","setup":"hi","punchling":"hello"},{"id":3,"type":"userjoke","setup":" what 6 x 3?","punchling":" 63 buliding!"}]}