The database really works better if you query it
This commit is contained in:
@@ -307,7 +307,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
async MESSAGE_REACTION_ADD(client, data) {
|
async MESSAGE_REACTION_ADD(client, data) {
|
||||||
if (data.user_id === client.user.id) return // m2d reactions are added by the discord bot user - do not reflect them back to matrix.
|
if (data.user_id === client.user.id) return // m2d reactions are added by the discord bot user - do not reflect them back to matrix.
|
||||||
if (data.emoji.name === "❓" && select("event_message", "message_id", {message_id: data.message_id, source: 0})) {
|
if (data.emoji.name === "❓" && select("event_message", "message_id", {message_id: data.message_id, source: 0, part: 0}).get()) { // source 0 = matrix
|
||||||
const guild_id = data.guild_id ?? client.channels.get(data.channel_id)["guild_id"]
|
const guild_id = data.guild_id ?? client.channels.get(data.channel_id)["guild_id"]
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
client.snow.channel.deleteReaction(data.channel_id, data.message_id, data.emoji.name).catch(() => {}),
|
client.snow.channel.deleteReaction(data.channel_id, data.message_id, data.emoji.name).catch(() => {}),
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const webGuild = sync.require("../../web/routes/guild")
|
|||||||
*/
|
*/
|
||||||
async function _interact({guild_id, data}, {api}) {
|
async function _interact({guild_id, data}, {api}) {
|
||||||
const message = from("event_message").join("message_room", "message_id").join("historical_channel_room", "historical_room_index")
|
const message = from("event_message").join("message_room", "message_id").join("historical_channel_room", "historical_room_index")
|
||||||
.select("source", "reference_channel_id", "room_id", "event_id").where({message_id: data.target_id, part: 0}).get()
|
.select("source", "reference_channel_id", "room_id", "event_id").where({message_id: data.target_id}).and("ORDER BY part").get()
|
||||||
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user