Skip to content

Commit

Permalink
[Fix] Single table mention
Browse files Browse the repository at this point in the history
  • Loading branch information
the-AjK committed Apr 9, 2018
1 parent cf6b943 commit 28c95ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/telegram/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ bot.mention(['@tables', '@table'], (ctx) => {
if (mention == 'table') {
//find user table and broadcast the message
for (let i = 0; i < orders.length; i++) {

if (orders[i].owner._id.equals(ctx.session.user._id)) {
let orderOwner = orders[i].owner._id.toString(),
user = ctx.session.user._id.toString();
if ( orderOwner === user) {
userHasOrdered = true;
const userTableName = orders[i].table.name;
for (let j = 0; j < orders.length; j++) {
if (!orders[j].owner._id.equals(ctx.session.user._id) &&
orders[j].table.name == userTableName) {
if (orders[j].table.name == userTableName && orderOwner != user) {
bot.telegram.sendMessage(orders[j].owner.telegram.id, message, {
parse_mode: "markdown"
});
Expand Down

0 comments on commit 28c95ec

Please sign in to comment.