3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Bot now connects, lint fixes

This commit is contained in:
Dark 2021-06-02 19:35:44 +02:00
parent d0a1beb809
commit edcfd2333f
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
16 changed files with 29 additions and 24 deletions

View file

@ -211,8 +211,9 @@ export class GuildSavedMessages extends BaseGuildRepository {
const newMessage = { ...oldMessage, data: newData };
//@ts-ignore
await this.messages.update( // FIXME?
// @ts-ignore
await this.messages.update(
// FIXME?
{ id },
{
data: newData,

View file

@ -267,6 +267,8 @@ connect().then(async () => {
startUptimeCounter();
});
logger.info("Starting the bot");
logger.info("Logging in...");
await client.login(process.env.token);
logger.info("Initializing the bot");
bot.initialize();
});

View file

@ -26,12 +26,13 @@ export const SetSlowmodeAction = automodAction({
continue;
}
let channelsToSlowmode: TextChannel[] = [];
const channelsToSlowmode: TextChannel[] = [];
if (channel.type === ChannelTypeStrings.CATEGORY) {
// Find all text channels within the category
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);
}
}
} else {
channelsToSlowmode.push(channel as TextChannel);

View file

@ -21,7 +21,7 @@ export async function postToCaseLogChannel(
let result;
try {
if (file != undefined) {
if (file != null) {
content.files = file;
}
result = await caseLogChannel.send({ ...content, split: false });

View file

@ -14,8 +14,8 @@ export async function censorMessage(
pluginData.state.serverLogs.ignoreLog(LogType.MESSAGE_DELETE, savedMessage.id);
try {
const channel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel;
await channel.messages.delete(savedMessage.id);
const resolvedChannel = pluginData.guild.channels.resolve(savedMessage.channel_id) as TextChannel;
await resolvedChannel.messages.delete(savedMessage.id);
} catch {
return;
}

View file

@ -29,7 +29,7 @@ function updateGuildInfo(pluginData: GuildPluginData<GuildInfoSaverPluginType>)
pluginData.state.allowedGuilds.updateInfo(
pluginData.guild.id,
pluginData.guild.name,
pluginData.guild.iconURL,
pluginData.guild.iconURL(),
pluginData.guild.ownerID,
);
}

View file

@ -61,7 +61,7 @@ export const UnmuteCmd = modActionsCmd({
} else {
// 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 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);
if (!reply /*|| reply.name === "❌"*/) {

View file

@ -73,7 +73,7 @@ export const WarnCmd = modActionsCmd({
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();
if (!reply /*|| reply.name === "❌"*/) {
msg.channel.send(errorMessage("Warn cancelled by moderator"));

View file

@ -46,7 +46,7 @@ export async function warnMember(
const failedMsg = await warnOptions.retryPromptChannel.send(
"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();
if (!reply /*|| reply.name === "❌"*/) {
return {

View file

@ -27,7 +27,7 @@ export const LoadDataEvt = persistEvt({
return;
}
let toRestore: GuildMemberEditData = {};
const toRestore: GuildMemberEditData = {};
const config = await pluginData.config.getForMember(member);
const restoredData: string[] = [];

View file

@ -41,7 +41,7 @@ export const AboutCmd = utilityCmd({
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, {
largest: 2,

View file

@ -309,7 +309,7 @@ async function performMemberSearch(
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"]) {
matchingMembers = await asyncFilter(matchingMembers, async member => {
if (member.game) {

View file

@ -2,7 +2,7 @@ import * as ioTs from "io-ts";
import { convertDelayStringToMS, convertMSToDelayString, getUrlsInString, tAllowedMentions } from "./utils";
import test from "ava";
import { erisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions";
import { ErisAllowedMentionFormat } from "./utils/erisAllowedMentionsToDjsMentionOptions";
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 => {
type TAllowedMentions = ioTs.TypeOf<typeof tAllowedMentions>;
const typeTest: AssertEquals<TAllowedMentions, erisAllowedMentionFormat> = true;
const typeTest: AssertEquals<TAllowedMentions, ErisAllowedMentionFormat> = true;
t.pass();
});

View file

@ -1159,7 +1159,7 @@ export async function resolveUser<T>(bot, value) {
}
// 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);
}

View file

@ -1,13 +1,13 @@
import { MessageMentionOptions, MessageMentionTypes } from "discord.js";
export function erisAllowedMentionsToDjsMentionOptions(
allowedMentions: erisAllowedMentionFormat | undefined,
allowedMentions: ErisAllowedMentionFormat | undefined,
): MessageMentionOptions | undefined {
if (allowedMentions === undefined) return undefined;
let parse: MessageMentionTypes[] = [];
let users: string[] | undefined = undefined;
let roles: string[] | undefined = undefined;
const parse: MessageMentionTypes[] = [];
let users: string[] | undefined;
let roles: string[] | undefined;
if (Array.isArray(allowedMentions.users)) {
users = allowedMentions.users;
@ -35,7 +35,7 @@ export function erisAllowedMentionsToDjsMentionOptions(
return mentions;
}
export interface erisAllowedMentionFormat {
export interface ErisAllowedMentionFormat {
everyone?: boolean | undefined;
users?: boolean | string[] | undefined;
roles?: boolean | string[] | undefined;

View file

@ -123,7 +123,7 @@ export function decodeAndValidateStrict<T extends t.HasProps>(
err => report(validationResult),
result => {
// Make sure there are no extra properties
if (debug)
if (debug) {
console.log(
"JSON.stringify() check:",
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",
result,
);
}
if (JSON.stringify(value) !== JSON.stringify(result)) {
const diff = deepDiff(result, value);
const errors = diff.filter(d => d.kind === "N").map(d => `Unknown property <${d.path.join(".")}>`);