Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function refreshOnGetDetail(msg, result, bot) {
try {
let gid = parseInt(result[1])
if (gid > 0) return
const record = await comlib.getRecord(gid)
if (!record) return
// if (!record.type == 'channel' && !record.is_public) return
let member_count = 0
try {
member_count = await bot.getChatMembersCount(gid)
} catch (e) {
member_count = await tmeassist.getMemberCount(record.is_public ? `https://t.me/${record.username}` : record.invite_link)
if (!member_count) member_count = require('rethinkdb').literal()
}
return await comlib.silentUpdate(gid, {
member_count
})
} catch (e) {
console.error(e.message)
}
}
onConnect(function(err, conn) {
let query = r.db("mmorpg").table("config")(0);
if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})
query.run(conn)
.then(function(cursor) { return cursor; })
.then(function(output) {
exports.reloadConfig(() => {
console.log("[I] Server configuration changes saved.");
});
callback();
})
.finally(() => { conn.close(); })
})
}
onConnect(function(err, conn) {
let query = r.db("mmorpg").table("config")(0);
if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})
query.run(conn)
.then(function(cursor) { return cursor; })
.then(function(output) {
exports.reloadConfig(() => {
console.log("[I] Server configuration changes saved.");
});
callback();
})
.finally(() => { conn.close(); })
})
}
FRIDAY: r.friday,
SATURDAY: r.saturday,
SUNDAY: r.sunday,
JANUARY: r.january,
FEBRUARY: r.february,
MARCH: r.march,
APRIL: r.april,
MAY: r.may,
JUNE: r.june,
JULY: r.july,
AUGUST: r.august,
SEPTEMBER: r.september,
OCTOBER: r.october,
NOVEMBER: r.november,
DECEMBER: r.december,
LITERAL: r.literal({}),
GROUP: r([]).group(''),
SUM: r([]).sum(),
AVG: r([]).avg(),
MIN: r([]).min(),
MAX: r([]).max(),
SPLIT: r([]).split(),
UNGROUP: r([]).ungroup(),
RANDOM: r.random(),
CHANGES: r([]).changes(),
ARGS: r.args([]),
BINARY: r.binary(new Buffer(0)),
GEOJSON: r.geojson({}),
TO_GEOJSON: r({}).toGeojson(),
POINT: r.point(0, 0),
LINE: r.line([], []),
POLYGON: r.polygon([], [], []),
onConnect(function(err, conn) {
let query = r.db("mmorpg").table("config")(0);
if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})
query.run(conn)
.then(function(cursor) { return cursor; })
.then(function(output) {
exports.reloadConfig(() => {
console.log("[I] Server configuration changes saved.");
});
callback();
})
.finally(() => { conn.close(); })
})
}
onConnect(function(err, conn) {
let query = r.db("mmorpg").table("config")(0);
if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})
query.run(conn)
.then(function(cursor) { return cursor; })
.then(function(output) {
exports.reloadConfig(() => {
console.log("[I] Server configuration changes saved.");
});
callback();
})
.finally(() => { conn.close(); })
})
}
async function removeUserFlag(uid, flag) {
let updation = {}
if (Array.isArray(flag)) {
for (let i of flag) {
updation[i] = r.literal()
}
} else {
updation[flag] = r.literal()
}
return r.table('userdata').get(parseInt(uid)).update(updation)
}
indexFunction: function(device) {
return r.branch(
device('present')
, device('owner')('email')
, r.literal()
)
}
}
return Promise.resolve().then(() => {
white('Rewriting hz_collections to new format')
return r.db(project).table('hz_collections')
.update({ table: r.literal() })
.run(this.conn)
}).then(() => green(' ├── "table" field removed'))
.then(() => r.db(project).table('hz_collections')
dbapi.resetUserSettings = function(email) {
return db.run(r.table('users').get(email).update({
settings: r.literal({})
}))
}