3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 20:35:02 +00:00

!source: don't show source of messages you don't have access to; allow mods to use the command by default

This commit is contained in:
Dragory 2020-08-05 23:57:09 +03:00
parent 14af94e7a3
commit 60aff76ebe
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
6 changed files with 137 additions and 12 deletions

View file

@ -0,0 +1,17 @@
import { SavedMessage } from "./entities/SavedMessage";
import { Repository, getRepository } from "typeorm";
let repository: Repository<SavedMessage>;
export async function getChannelIdFromMessageId(messageId: string): Promise<string | null> {
if (!repository) {
repository = getRepository(SavedMessage);
}
const savedMessage = await repository.findOne(messageId);
if (savedMessage) {
return savedMessage.channel_id;
}
return null;
}