mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Bot now connects, lint fixes
This commit is contained in:
parent
d0a1beb809
commit
edcfd2333f
16 changed files with 29 additions and 24 deletions
|
@ -211,8 +211,9 @@ export class GuildSavedMessages extends BaseGuildRepository {
|
||||||
|
|
||||||
const newMessage = { ...oldMessage, data: newData };
|
const newMessage = { ...oldMessage, data: newData };
|
||||||
|
|
||||||
//@ts-ignore
|
// @ts-ignore
|
||||||
await this.messages.update( // FIXME?
|
await this.messages.update(
|
||||||
|
// FIXME?
|
||||||
{ id },
|
{ id },
|
||||||
{
|
{
|
||||||
data: newData,
|
data: newData,
|
||||||
|
|
|
@ -267,6 +267,8 @@ connect().then(async () => {
|
||||||
startUptimeCounter();
|
startUptimeCounter();
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info("Starting the bot");
|
logger.info("Logging in...");
|
||||||
|
await client.login(process.env.token);
|
||||||
|
logger.info("Initializing the bot");
|
||||||
bot.initialize();
|
bot.initialize();
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,12 +26,13 @@ export const SetSlowmodeAction = automodAction({
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let channelsToSlowmode: TextChannel[] = [];
|
const channelsToSlowmode: TextChannel[] = [];
|
||||||
if (channel.type === ChannelTypeStrings.CATEGORY) {
|
if (channel.type === ChannelTypeStrings.CATEGORY) {
|
||||||
// Find all text channels within the category
|
// Find all text channels within the category
|
||||||
for (const ch of pluginData.guild.channels.cache.values()) {
|
for (const ch of pluginData.guild.channels.cache.values()) {
|
||||||
if (ch.parentID === channel.id && ch.type === ChannelTypeStrings.TEXT)
|
if (ch.parentID === channel.id && ch.type === ChannelTypeStrings.TEXT) {
|
||||||
channelsToSlowmode.push(ch as TextChannel);
|
channelsToSlowmode.push(ch as TextChannel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
channelsToSlowmode.push(channel as TextChannel);
|
channelsToSlowmode.push(channel as TextChannel);
|
||||||
|
|
|
@ -21,7 +21,7 @@ export async function postToCaseLogChannel(
|
||||||
|
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
if (file != undefined) {
|
if (file != null) {
|
||||||
content.files = file;
|
content.files = file;
|
||||||
}
|
}
|
||||||
result = await caseLogChannel.send({ ...content, split: false });
|
result = await caseLogChannel.send({ ...content, split: false });
|
||||||
|
|
|
@ -14,8 +14,8 @@ export async function censorMessage(
|
||||||
pluginData.state.serverLogs.ignoreLog(LogType.MESSAGE_DELETE, savedMessage.id);
|
pluginData.state.serverLogs.ignoreLog(LogType.MESSAGE_DELETE, savedMessage.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const channel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel;
|
const resolvedChannel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel;
|
||||||
await channel.messages.delete(savedMessage.id);
|
await resolvedChannel.messages.delete(savedMessage.id);
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function updateGuildInfo(pluginData: GuildPluginData<GuildInfoSaverPluginType>)
|
||||||
pluginData.state.allowedGuilds.updateInfo(
|
pluginData.state.allowedGuilds.updateInfo(
|
||||||
pluginData.guild.id,
|
pluginData.guild.id,
|
||||||
pluginData.guild.name,
|
pluginData.guild.name,
|
||||||
pluginData.guild.iconURL,
|
pluginData.guild.iconURL(),
|
||||||
pluginData.guild.ownerID,
|
pluginData.guild.ownerID,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const UnmuteCmd = modActionsCmd({
|
||||||
} else {
|
} else {
|
||||||
// Ask the mod if we should upgrade to a forceunmute as the user is not on the server
|
// Ask the mod if we should upgrade to a forceunmute as the user is not on the server
|
||||||
const notOnServerMsg = await msg.channel.send("User not found on the server, forceunmute instead?");
|
const notOnServerMsg = await msg.channel.send("User not found on the server, forceunmute instead?");
|
||||||
const reply = false; //await waitForReaction(pluginData.client, notOnServerMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton
|
const reply = false; // await waitForReaction(pluginData.client, notOnServerMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton
|
||||||
|
|
||||||
notOnServerMsg.delete().catch(noop);
|
notOnServerMsg.delete().catch(noop);
|
||||||
if (!reply /*|| reply.name === "❌"*/) {
|
if (!reply /*|| reply.name === "❌"*/) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ export const WarnCmd = modActionsCmd({
|
||||||
config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`),
|
config.warn_notify_message.replace("{priorWarnings}", `${priorWarnAmount}`),
|
||||||
);
|
);
|
||||||
|
|
||||||
const reply = false; //await waitForReaction(pluginData.client, tooManyWarningsMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton
|
const reply = false; // await waitForReaction(pluginData.client, tooManyWarningsMsg, ["✅", "❌"], msg.author.id); FIXME waiting on waitForButton
|
||||||
tooManyWarningsMsg.delete();
|
tooManyWarningsMsg.delete();
|
||||||
if (!reply /*|| reply.name === "❌"*/) {
|
if (!reply /*|| reply.name === "❌"*/) {
|
||||||
msg.channel.send(errorMessage("Warn cancelled by moderator"));
|
msg.channel.send(errorMessage("Warn cancelled by moderator"));
|
||||||
|
|
|
@ -46,7 +46,7 @@ export async function warnMember(
|
||||||
const failedMsg = await warnOptions.retryPromptChannel.send(
|
const failedMsg = await warnOptions.retryPromptChannel.send(
|
||||||
"Failed to message the user. Log the warning anyway?",
|
"Failed to message the user. Log the warning anyway?",
|
||||||
);
|
);
|
||||||
const reply = false; //await waitForReaction(pluginData.client, failedMsg, ["✅", "❌"]); FIXME waiting on waitForButton
|
const reply = false; // await waitForReaction(pluginData.client, failedMsg, ["✅", "❌"]); FIXME waiting on waitForButton
|
||||||
failedMsg.delete();
|
failedMsg.delete();
|
||||||
if (!reply /*|| reply.name === "❌"*/) {
|
if (!reply /*|| reply.name === "❌"*/) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const LoadDataEvt = persistEvt({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let toRestore: GuildMemberEditData = {};
|
const toRestore: GuildMemberEditData = {};
|
||||||
const config = await pluginData.config.getForMember(member);
|
const config = await pluginData.config.getForMember(member);
|
||||||
const restoredData: string[] = [];
|
const restoredData: string[] = [];
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export const AboutCmd = utilityCmd({
|
||||||
version = "?";
|
version = "?";
|
||||||
}
|
}
|
||||||
|
|
||||||
//const shard = pluginData.client.shards.get(pluginData.client.guildShardMap[pluginData.guild.id])!; FIXME Sharding stuff
|
// const shard = pluginData.client.shards.get(pluginData.client.guildShardMap[pluginData.guild.id])!; FIXME Sharding stuff
|
||||||
|
|
||||||
const lastReload = humanizeDuration(Date.now() - pluginData.state.lastReload, {
|
const lastReload = humanizeDuration(Date.now() - pluginData.state.lastReload, {
|
||||||
largest: 2,
|
largest: 2,
|
||||||
|
|
|
@ -309,7 +309,7 @@ async function performMemberSearch(
|
||||||
|
|
||||||
const execRegExp = getOptimizedRegExpRunner(pluginData, isSafeRegex);
|
const execRegExp = getOptimizedRegExpRunner(pluginData, isSafeRegex);
|
||||||
|
|
||||||
/** FIXME if we ever get the intent for this again
|
/* FIXME if we ever get the intent for this again
|
||||||
if (args["status-search"]) {
|
if (args["status-search"]) {
|
||||||
matchingMembers = await asyncFilter(matchingMembers, async member => {
|
matchingMembers = await asyncFilter(matchingMembers, async member => {
|
||||||
if (member.game) {
|
if (member.game) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as ioTs from "io-ts";
|
||||||
import { convertDelayStringToMS, convertMSToDelayString, getUrlsInString, tAllowedMentions } from "./utils";
|
import { convertDelayStringToMS, convertMSToDelayString, getUrlsInString, tAllowedMentions } from "./utils";
|
||||||
|
|
||||||
import test from "ava";
|
import test from "ava";
|
||||||
import { erisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions";
|
import { ErisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions";
|
||||||
|
|
||||||
type AssertEquals<TActual, TExpected> = TActual extends TExpected ? true : false;
|
type AssertEquals<TActual, TExpected> = TActual extends TExpected ? true : false;
|
||||||
|
|
||||||
|
@ -52,6 +52,6 @@ test("delay strings: reverse conversion (conservative)", t => {
|
||||||
|
|
||||||
test("tAllowedMentions matches Eris's AllowedMentions", t => {
|
test("tAllowedMentions matches Eris's AllowedMentions", t => {
|
||||||
type TAllowedMentions = ioTs.TypeOf<typeof tAllowedMentions>;
|
type TAllowedMentions = ioTs.TypeOf<typeof tAllowedMentions>;
|
||||||
const typeTest: AssertEquals<TAllowedMentions, erisAllowedMentionFormat> = true;
|
const typeTest: AssertEquals<TAllowedMentions, ErisAllowedMentionFormat> = true;
|
||||||
t.pass();
|
t.pass();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ export async function resolveUser<T>(bot, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have the user cached, return that directly
|
// If we have the user cached, return that directly
|
||||||
if (bot.users.has(userId)) {
|
if (bot.users.cache.has(userId)) {
|
||||||
return bot.users.get(userId);
|
return bot.users.get(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { MessageMentionOptions, MessageMentionTypes } from "discord.js";
|
import { MessageMentionOptions, MessageMentionTypes } from "discord.js";
|
||||||
|
|
||||||
export function erisAllowedMentionsToDjsMentionOptions(
|
export function erisAllowedMentionsToDjsMentionOptions(
|
||||||
allowedMentions: erisAllowedMentionFormat | undefined,
|
allowedMentions: ErisAllowedMentionFormat | undefined,
|
||||||
): MessageMentionOptions | undefined {
|
): MessageMentionOptions | undefined {
|
||||||
if (allowedMentions === undefined) return undefined;
|
if (allowedMentions === undefined) return undefined;
|
||||||
|
|
||||||
let parse: MessageMentionTypes[] = [];
|
const parse: MessageMentionTypes[] = [];
|
||||||
let users: string[] | undefined = undefined;
|
let users: string[] | undefined;
|
||||||
let roles: string[] | undefined = undefined;
|
let roles: string[] | undefined;
|
||||||
|
|
||||||
if (Array.isArray(allowedMentions.users)) {
|
if (Array.isArray(allowedMentions.users)) {
|
||||||
users = allowedMentions.users;
|
users = allowedMentions.users;
|
||||||
|
@ -35,7 +35,7 @@ export function erisAllowedMentionsToDjsMentionOptions(
|
||||||
return mentions;
|
return mentions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface erisAllowedMentionFormat {
|
export interface ErisAllowedMentionFormat {
|
||||||
everyone?: boolean | undefined;
|
everyone?: boolean | undefined;
|
||||||
users?: boolean | string[] | undefined;
|
users?: boolean | string[] | undefined;
|
||||||
roles?: boolean | string[] | undefined;
|
roles?: boolean | string[] | undefined;
|
||||||
|
|
|
@ -123,7 +123,7 @@ export function decodeAndValidateStrict<T extends t.HasProps>(
|
||||||
err => report(validationResult),
|
err => report(validationResult),
|
||||||
result => {
|
result => {
|
||||||
// Make sure there are no extra properties
|
// Make sure there are no extra properties
|
||||||
if (debug)
|
if (debug) {
|
||||||
console.log(
|
console.log(
|
||||||
"JSON.stringify() check:",
|
"JSON.stringify() check:",
|
||||||
JSON.stringify(value) === JSON.stringify(result)
|
JSON.stringify(value) === JSON.stringify(result)
|
||||||
|
@ -131,6 +131,7 @@ export function decodeAndValidateStrict<T extends t.HasProps>(
|
||||||
: "they are not the same, might have excess",
|
: "they are not the same, might have excess",
|
||||||
result,
|
result,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if (JSON.stringify(value) !== JSON.stringify(result)) {
|
if (JSON.stringify(value) !== JSON.stringify(result)) {
|
||||||
const diff = deepDiff(result, value);
|
const diff = deepDiff(result, value);
|
||||||
const errors = diff.filter(d => d.kind === "N").map(d => `Unknown property <${d.path.join(".")}>`);
|
const errors = diff.filter(d => d.kind === "N").map(d => `Unknown property <${d.path.join(".")}>`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue