fixed the fallback channel setting
This commit is contained in:
1
legacy/config.json
Normal file
1
legacy/config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"token":"YOUR BOT TOKEN HERE","game":"BOT GAME HERE","owner":"BOT OWNER ID HERE","hastebinServer":"https://hastebin.com"}
|
||||
@@ -14,6 +14,7 @@
|
||||
"colors": "^1.4.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"eris": "^0.13.3",
|
||||
"express-authentication": "^0.3.2",
|
||||
"moment": "^2.27.0",
|
||||
"sequelize": "^6.3.3",
|
||||
"sqlite3": "^5.0.0"
|
||||
|
||||
@@ -151,7 +151,18 @@ async function SetPrefix(message, args)
|
||||
|
||||
async function SetLogChannel(message, args)
|
||||
{
|
||||
Database.UpdateGuildLogChannel(guild.id, message.channel.id);
|
||||
const AlreadyGuild = await Database.FetchGuild(message.guildID);
|
||||
const guild = await Discord.bot.getRESTGuild(message.guildID);
|
||||
if (AlreadyGuild == -1)
|
||||
{
|
||||
Database.NewGuild(guild.id, guild.name, '*', message.channel.id, {}, 0);
|
||||
} else {
|
||||
if (AlreadyGuild.name != guild.name)
|
||||
{
|
||||
Database.UpdateGuildName(guild.id, message.guild.name);
|
||||
}
|
||||
Database.UpdateGuildLogChannel(guild.id, message.channel.id);
|
||||
}
|
||||
|
||||
DiscordHelpers.SendMessageSafe(message.channel.id, 'Logging fallback channel set to this channel');
|
||||
}
|
||||
|
||||
@@ -606,27 +606,25 @@ async function GuildMemberRemove(guild, member)
|
||||
DiscordHelpers.SendMessageSafe(FallbackChannel, { embed: embed.sendable });
|
||||
}
|
||||
|
||||
// FIXME: this is broken af lmao
|
||||
async function MessageDelete(message)
|
||||
{
|
||||
const FallbackChannel = await GetLogChannel(message.channel.guild.id);
|
||||
if (FallbackChannel == -1) return;
|
||||
|
||||
/*
|
||||
* IMPORTANT(aosync): Check if audit log entry is recent enough. Because it might cause it to use an entry for a previous action.
|
||||
* When this is implemented, we'll just have to assume deleter is author when no recent enough entry is found.
|
||||
*/
|
||||
|
||||
// FIXME: Check if audit log entry is recent enough. Because it might cause it to use an entry for a previous action.
|
||||
// When this is implemented, we'll just have to assume deleter is author when no recent enough entry is found.
|
||||
|
||||
const LastAuditEntry = (await message.channel.guild.getAuditLogs(1, undefined, MESSAGE_DELETE)).entries[0];
|
||||
const DeletedMessage = LastAuditEntry.channel.messages.random();
|
||||
|
||||
try {
|
||||
var authorMention = 'Author not found';
|
||||
var author = {
|
||||
let authorMention = 'Author not found';
|
||||
let author = {
|
||||
name: 'Unknown',
|
||||
url: 'https://logori.xyz'
|
||||
}
|
||||
var responsible = LastAuditEntry ? LastAuditEntry.user.mention : 'Message author';
|
||||
let responsible = LastAuditEntry ? LastAuditEntry.user.mention : 'Message author';
|
||||
if (message.author) {
|
||||
author.name = message.author.username;
|
||||
author.icon_url = message.author.avatarURL;
|
||||
@@ -639,7 +637,7 @@ async function MessageDelete(message)
|
||||
// Left blank because currently inaccurate. When the IMPORTANT comment is achieved, the above lines can be uncommented.
|
||||
}
|
||||
|
||||
var embed = new DiscordEmbed({
|
||||
let embed = new DiscordEmbed({
|
||||
author: author,
|
||||
title: 'Message Deleted',
|
||||
colour: ColourConvert('#E0532B'),
|
||||
|
||||
@@ -16,7 +16,8 @@ module.exports.GetMemberJoinPos = (memberid, guild) =>
|
||||
}
|
||||
module.exports.SendMessageSafe = async (channelid, message) =>
|
||||
{
|
||||
// TODO: make this an actual check instead of a guess
|
||||
// TODO: make this an actual check instead of a guess & catch lol
|
||||
|
||||
try {
|
||||
Discord.bot.createMessage(channelid, message);
|
||||
} catch (e)
|
||||
|
||||
Reference in New Issue
Block a user