This commit is contained in:
Ben
2020-08-04 23:26:33 +01:00
parent 686f7eb3ad
commit e56d3b9092
2 changed files with 25 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 Alejandro W. Sior
Copyright (c) 2018-2020 Alejandro W. Sior, Benjamin Kyd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -16,6 +16,7 @@ module.exports.registerCommands = async function()
Commands['initserv'] = { command: 'initserv', alias: 'nil', name: 'Initialize Server', desc: 'Initialises a new Guild', callback: InitializeGuild, adminOnly: true };
Commands['setprefix'] = { command: 'setprefix', alias: 'prefix', name: 'Set Prefix', desc: 'Sets the servers prefix for the guild', callback: SetPrefix, adminOnly: true };
Commands['setfallbackchannel'] = { command: 'setlogchannel', alias: 'setlogchannel', name: 'Set Log Channel', desc: 'Sets the guild log channel to the current channel', callback: SetLogChannel, adminOnly: true };
Commands['me'] = { command: 'me', alias: 'nil', name: 'Me', desc: 'Returns the users profile on the logori site', callback: MeCommand, adminOnly: false};
// create a cache of prefix's so that the database doesn't have to be
// queried every single time, new guilds should also add themselve's
@@ -109,6 +110,21 @@ module.exports.newMessage = async function(message)
async function InitializeGuild(message, args)
{
// Outlines private policy etc
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);
}
Discord.bot.createMessage(message.channel.id, 'Server successfully initialized, the fallback events channel has been set to this channel, you can change this at any time with *setfallbackchannel');
Discord.bot.createMessage(message.channel.id, 'By using Logori 2.0, You agree to the private policy clearly outlined at https://logori.xyz/privatepolicy and it is your responsibility as guild administrators to inform members of data collection - as this is a logging bot');
}
@@ -132,5 +148,12 @@ async function SetPrefix(message, args)
async function SetLogChannel(message, args)
{
Database.UpdateGuildLogChannel(guild.id, message.channel.id);
Discord.bot.createMessage(message.channel.id, 'Logging fallback channel set to this channel');
}
async function MeCommand(message, args)
{
Discord.bot.createMessage(message.channel.id, `All of your data can be accessed here: https://logori.xyz/api/v1/user/${message.author.id}`);
}