Browse Source

log, fixwelcome

push-params
Evan Feenstra 4 years ago
parent
commit
a3bf50ea19
  1. 7
      dist/src/builtin/welcome.js
  2. 2
      dist/src/builtin/welcome.js.map
  3. 1
      dist/src/controllers/chatTribes.js
  4. 2
      dist/src/controllers/chatTribes.js.map
  5. 3
      dist/src/network/send.js
  6. 2
      dist/src/network/send.js.map
  7. 7
      src/builtin/welcome.ts
  8. 1
      src/controllers/chatTribes.ts
  9. 3
      src/network/send.ts

7
dist/src/builtin/welcome.js

@ -26,14 +26,12 @@ function init() {
const arr = (message.content && message.content.split(' ')) || [];
console.log('message.type', message.type);
const isGroupJoin = message.type === constants.message_types.group_join;
console.log('isGroupJoin', isGroupJoin);
if (arr.length < 2 && !isGroupJoin)
return;
if (arr[0] !== '/welcome' && !isGroupJoin)
return;
const cmd = arr[1];
const isAdmin = message.member.roles.find(role => role.name === 'Admin');
if (!isAdmin)
return;
if (isGroupJoin) {
try {
const chat = yield models_1.models.Chat.findOne({ where: { uuid: message.channel.id } });
@ -59,6 +57,9 @@ function init() {
console.log("WELCOME BOT ERROR", e);
}
}
const isAdmin = message.member.roles.find(role => role.name === 'Admin');
if (!isAdmin)
return;
switch (cmd) {
case 'setmessage':
if (arr.length < 3)

2
dist/src/builtin/welcome.js.map

@ -1 +1 @@
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../src/builtin/welcome.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAoC;AACpC,4CAAgD;AAChD,sCAAkC;AAClC,6BAA4B;AAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEjC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAA;AAE9E,IAAI,OAAO,GAAG,KAAK,CAAA;AAEnB,SAAgB,IAAI;IAClB,IAAI,OAAO;QAAE,OAAM;IACnB,OAAO,GAAG,IAAI,CAAA;IAEd,MAAM,MAAM,GAAG,IAA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EAAE;wBACL,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO;qBAC7E;iBACF,CAAC,CAAA;gBACF,IAAI,CAAC,OAAO;oBAAE,OAAM;gBACpB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChD,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC9B,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;qBACvC,SAAS,CAAC,YAAY,CAAC;qBACvB,cAAc,CAAC,uCAAuC,CAAC,CAAA;gBAC1D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;gBACzC,OAAM;YAER;gBACE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;qBACpC,SAAS,CAAC,YAAY,CAAC;qBACvB,QAAQ,CAAC,eAAe,CAAC;qBACzB,SAAS,CAAC;oBACT,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,+BAA+B,EAAE;oBACvE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;iBACzC,CAAC;qBACD,YAAY,CAAC,MAAM,CAAC,CAAA;gBACvB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;gBAC/B,OAAM;SACT;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AA7ED,oBA6EC;AAED,MAAM,MAAM,GAAG;;OAER,CAAA"}

1
dist/src/controllers/chatTribes.js

@ -414,6 +414,7 @@ function receiveTribeDelete(payload) {
exports.receiveTribeDelete = receiveTribeDelete;
function replayChatHistory(chat, contact) {
return __awaiter(this, void 0, void 0, function* () {
console.log('-> replayHistory');
if (!(chat && chat.id && contact && contact.id)) {
return console.log('[tribes] cant replay history');
}

2
dist/src/controllers/chatTribes.js.map

File diff suppressed because one or more lines are too long

3
dist/src/network/send.js

@ -94,6 +94,7 @@ function sendMessage(params) {
mqttTopic = ''; // FORCE KEYSEND!!!
}
const m = yield msg_1.personalizeMessage(msg, contact, isTribeOwner);
console.log('-> personalized msg', m);
const opts = {
dest: destkey,
data: m,
@ -134,7 +135,7 @@ function signAndSend(opts, mqttTopic, replayingHistory) {
opts.amt = opts.amt || 0;
const sig = yield signer.signAscii(data);
data = data + sig;
// console.log("ACTUALLY SEND", mqttTopic)
console.log("-> ACTUALLY SEND: topic:", mqttTopic);
try {
if (mqttTopic) {
yield tribes.publish(mqttTopic, data, function () {

2
dist/src/network/send.js.map

File diff suppressed because one or more lines are too long

7
src/builtin/welcome.ts

@ -19,13 +19,11 @@ export function init() {
const arr = (message.content && message.content.split(' ')) || []
console.log('message.type', message.type)
const isGroupJoin = message.type === constants.message_types.group_join
console.log('isGroupJoin',isGroupJoin)
if (arr.length < 2 && !isGroupJoin) return
if (arr[0] !== '/welcome' && !isGroupJoin) return
const cmd = arr[1]
const isAdmin = message.member.roles.find(role => role.name === 'Admin')
if(!isAdmin) return
if (isGroupJoin) {
try{
const chat = await models.Chat.findOne({ where: { uuid: message.channel.id } })
@ -50,6 +48,9 @@ export function init() {
}
}
const isAdmin = message.member.roles.find(role => role.name === 'Admin')
if(!isAdmin) return
switch (cmd) {
case 'setmessage':

1
src/controllers/chatTribes.ts

@ -415,6 +415,7 @@ export async function receiveTribeDelete(payload) {
}
export async function replayChatHistory(chat, contact) {
console.log('-> replayHistory')
if(!(chat&&chat.id&&contact&&contact.id)){
return console.log('[tribes] cant replay history')
}

3
src/network/send.ts

@ -93,6 +93,7 @@ export async function sendMessage(params) {
}
const m = await personalizeMessage(msg, contact, isTribeOwner)
console.log('-> personalized msg',m)
const opts = {
dest: destkey,
data: m,
@ -130,7 +131,7 @@ export function signAndSend(opts, mqttTopic?:string, replayingHistory?:boolean){
const sig = await signer.signAscii(data)
data = data + sig
// console.log("ACTUALLY SEND", mqttTopic)
console.log("-> ACTUALLY SEND: topic:", mqttTopic)
try {
if(mqttTopic) {
await tribes.publish(mqttTopic, data, function(){

Loading…
Cancel
Save