Update references to bot-sdk

This commit is contained in:
Will Hunt 2024-09-19 14:06:34 +01:00
parent 167597fbb9
commit c501f3d290
75 changed files with 76 additions and 76 deletions

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import * as Sentry from "@sentry/node"; import * as Sentry from "@sentry/node";
import { extractRequestError, LogLevel, LogService, MessageType, Permalinks, TextualMessageEventContent, UserID } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService, MessageType, Permalinks, TextualMessageEventContent, UserID } from "@vector-im/matrix-bot-sdk";
import { IConfig } from "./config"; import { IConfig } from "./config";
import { MatrixSendClient } from "./MatrixEmitter"; import { MatrixSendClient } from "./MatrixEmitter";
import { htmlEscape } from "./utils"; import { htmlEscape } from "./utils";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import EventEmitter from "events"; import EventEmitter from "events";
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
/** /**
* This is an interface created in order to keep the event listener * This is an interface created in order to keep the event listener

View File

@ -19,7 +19,7 @@ import {
LogLevel, LogLevel,
LogService, LogService,
MembershipEvent, MembershipEvent,
} from "matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import { ALL_RULE_TYPES as ALL_BAN_LIST_RULE_TYPES } from "./models/ListRule"; import { ALL_RULE_TYPES as ALL_BAN_LIST_RULE_TYPES } from "./models/ListRule";
import { COMMAND_PREFIX, handleCommand } from "./commands/CommandHandler"; import { COMMAND_PREFIX, handleCommand } from "./commands/CommandHandler";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import AwaitLock from 'await-lock'; import AwaitLock from 'await-lock';
import { extractRequestError, LogService, Permalinks } from "matrix-bot-sdk"; import { extractRequestError, LogService, Permalinks } from "@vector-im/matrix-bot-sdk";
import { IConfig } from "./config"; import { IConfig } from "./config";
import { MatrixSendClient } from './MatrixEmitter'; import { MatrixSendClient } from './MatrixEmitter';
const PROTECTED_ROOMS_EVENT_TYPE = "org.matrix.mjolnir.protected_rooms"; const PROTECTED_ROOMS_EVENT_TYPE = "org.matrix.mjolnir.protected_rooms";

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { LogLevel, LogService, MatrixGlob, Permalinks, UserID } from "matrix-bot-sdk"; import { LogLevel, LogService, MatrixGlob, Permalinks, UserID } from "@vector-im/matrix-bot-sdk";
import { IConfig } from "./config"; import { IConfig } from "./config";
import ErrorCache, { ERROR_KIND_FATAL, ERROR_KIND_PERMISSION } from "./ErrorCache"; import ErrorCache, { ERROR_KIND_FATAL, ERROR_KIND_PERMISSION } from "./ErrorCache";
import ManagementRoomOutput from "./ManagementRoomOutput"; import ManagementRoomOutput from "./ManagementRoomOutput";

View File

@ -17,7 +17,7 @@ limitations under the License.
import { Bridge } from "matrix-appservice-bridge"; import { Bridge } from "matrix-appservice-bridge";
import AccessControlUnit, { EntityAccess } from "../models/AccessControlUnit"; import AccessControlUnit, { EntityAccess } from "../models/AccessControlUnit";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";
import { Permalinks } from "matrix-bot-sdk"; import { Permalinks } from "@vector-im/matrix-bot-sdk";
/** /**
* Utility to manage which users have access to the application service, * Utility to manage which users have access to the application service,

View File

@ -3,7 +3,7 @@ import { Request, WeakEvent, BridgeContext, Bridge, Intent, Logger } from "matri
import { getProvisionedMjolnirConfig } from "../config"; import { getProvisionedMjolnirConfig } from "../config";
import { IConfig as IAppserviceConfig } from "./config/config"; import { IConfig as IAppserviceConfig } from "./config/config";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";
import { Permalinks, MatrixClient } from "matrix-bot-sdk"; import { Permalinks, MatrixClient } from "@vector-im/matrix-bot-sdk";
import { DataStore } from "./datastore"; import { DataStore } from "./datastore";
import { AccessControl } from "./AccessControl"; import { AccessControl } from "./AccessControl";
import { Access } from "../models/AccessControlUnit"; import { Access } from "../models/AccessControlUnit";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { extractRequestError, LogLevel, LogService } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService } from "@vector-im/matrix-bot-sdk";
// !mjolnir rooms add <room alias/ID> // !mjolnir rooms add <room alias/ID>
export async function execAddProtectedRoom(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execAddProtectedRoom(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
async function addRemoveFromDirectory(inRoomId: string, event: any, mjolnir: Mjolnir, roomRef: string, visibility: "public" | "private") { async function addRemoveFromDirectory(inRoomId: string, event: any, mjolnir: Mjolnir, roomRef: string, visibility: "public" | "private") {
const isAdmin = await mjolnir.isSynapseAdmin(); const isAdmin = await mjolnir.isSynapseAdmin();

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";
// !mjolnir move <alias> <new room ID> // !mjolnir move <alias> <new room ID>

View File

@ -18,7 +18,7 @@ import { Mjolnir } from "../Mjolnir";
import { execStatusCommand } from "./StatusCommand"; import { execStatusCommand } from "./StatusCommand";
import { execBanCommand, execUnbanCommand } from "./UnbanBanCommand"; import { execBanCommand, execUnbanCommand } from "./UnbanBanCommand";
import { execDumpRulesCommand, execRulesMatchingCommand } from "./DumpRulesCommand"; import { execDumpRulesCommand, execRulesMatchingCommand } from "./DumpRulesCommand";
import { extractRequestError, LogService, RichReply } from "matrix-bot-sdk"; import { extractRequestError, LogService, RichReply } from "@vector-im/matrix-bot-sdk";
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";
import { execSyncCommand } from "./SyncCommand"; import { execSyncCommand } from "./SyncCommand";
import { execPermissionCheckCommand } from "./PermissionCheckCommand"; import { execPermissionCheckCommand } from "./PermissionCheckCommand";

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";
import { Permalinks, RichReply } from "matrix-bot-sdk"; import { Permalinks, RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir list create <shortcode> <alias localpart> // !mjolnir list create <shortcode> <alias localpart>
export async function execCreateListCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execCreateListCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir deactivate <user ID> // !mjolnir deactivate <user ID>
export async function execDeactivateCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execDeactivateCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { EntityType } from "../models/ListRule"; import { EntityType } from "../models/ListRule";
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
import { EntityType } from "../models/ListRule"; import { EntityType } from "../models/ListRule";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, MatrixGlob, RichReply } from "matrix-bot-sdk"; import { LogLevel, MatrixGlob, RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir kick <user|filter> [room] [reason] // !mjolnir kick <user|filter> [room] [reason]
export async function execKickCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execKickCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { Permalinks, RichReply } from "matrix-bot-sdk"; import { Permalinks, RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir rooms // !mjolnir rooms
export async function execListProtectedRooms(roomId: string, event: any, mjolnir: Mjolnir) { export async function execListProtectedRooms(roomId: string, event: any, mjolnir: Mjolnir) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir make admin <room> [<user ID>] // !mjolnir make admin <room> [<user ID>]
export async function execMakeRoomAdminCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execMakeRoomAdminCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -16,7 +16,7 @@ limitations under the License.
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { extractRequestError, LogService, RichReply } from "matrix-bot-sdk"; import { extractRequestError, LogService, RichReply } from "@vector-im/matrix-bot-sdk";
import { isListSetting } from "../protections/ProtectionSettings"; import { isListSetting } from "../protections/ProtectionSettings";
// !mjolnir enable <protection> // !mjolnir enable <protection>

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { redactUserMessagesIn } from "../utils"; import { redactUserMessagesIn } from "../utils";
import { Permalinks } from "matrix-bot-sdk"; import { Permalinks } from "@vector-im/matrix-bot-sdk";
// !mjolnir redact <user ID> [room alias] [limit] // !mjolnir redact <user ID> [room alias] [limit]
export async function execRedactCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execRedactCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
export const DEFAULT_LIST_EVENT_TYPE = "org.matrix.mjolnir.default_list"; export const DEFAULT_LIST_EVENT_TYPE = "org.matrix.mjolnir.default_list";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { extractRequestError, LogLevel, LogService } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService } from "@vector-im/matrix-bot-sdk";
// !mjolnir powerlevel <user ID> <level> [room] // !mjolnir powerlevel <user ID> <level> [room]
export async function execSetPowerLevelCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execSetPowerLevelCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -1,5 +1,5 @@
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel } from "matrix-bot-sdk"; import { LogLevel } from "@vector-im/matrix-bot-sdk";
const EVENT_MODERATED_BY = "org.matrix.msc3215.room.moderation.moderated_by"; const EVENT_MODERATED_BY = "org.matrix.msc3215.room.moderation.moderated_by";
const EVENT_MODERATOR_OF = "org.matrix.msc3215.room.moderation.moderator_of"; const EVENT_MODERATOR_OF = "org.matrix.msc3215.room.moderation.moderator_of";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir shutdown room <room> [<message>] // !mjolnir shutdown room <room> [<message>]
export async function execShutdownRoomCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execShutdownRoomCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, LogService, RichReply } from "matrix-bot-sdk"; import { LogLevel, LogService, RichReply } from "@vector-im/matrix-bot-sdk";
import { htmlEscape, parseDuration } from "../utils"; import { htmlEscape, parseDuration } from "../utils";
import { ParseEntry } from "shell-quote"; import { ParseEntry } from "shell-quote";
import { HumanizeDurationLanguage, HumanizeDuration } from "humanize-duration-ts"; import { HumanizeDurationLanguage, HumanizeDuration } from "humanize-duration-ts";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir, STATE_CHECKING_PERMISSIONS, STATE_NOT_STARTED, STATE_RUNNING, STATE_SYNCING } from "../Mjolnir"; import { Mjolnir, STATE_CHECKING_PERMISSIONS, STATE_NOT_STARTED, STATE_RUNNING, STATE_SYNCING } from "../Mjolnir";
import { RichReply } from "matrix-bot-sdk"; import { RichReply } from "@vector-im/matrix-bot-sdk";
import { htmlEscape, parseDuration } from "../utils"; import { htmlEscape, parseDuration } from "../utils";
import { HumanizeDurationLanguage, HumanizeDuration } from "humanize-duration-ts"; import { HumanizeDurationLanguage, HumanizeDuration } from "humanize-duration-ts";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import {Mjolnir} from "../Mjolnir"; import {Mjolnir} from "../Mjolnir";
import {RichReply} from "matrix-bot-sdk"; import {RichReply} from "@vector-im/matrix-bot-sdk";
export async function execSuspendCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execSuspendCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {
const target = parts[2]; const target = parts[2];

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import PolicyList from "../models/PolicyList"; import PolicyList from "../models/PolicyList";
import { extractRequestError, LogLevel, LogService, MatrixGlob, RichReply } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService, MatrixGlob, RichReply } from "@vector-im/matrix-bot-sdk";
import { RULE_ROOM, RULE_SERVER, RULE_USER, USER_RULE_TYPES } from "../models/ListRule"; import { RULE_ROOM, RULE_SERVER, RULE_USER, USER_RULE_TYPES } from "../models/ListRule";
import { DEFAULT_LIST_EVENT_TYPE } from "./SetDefaultBanListCommand"; import { DEFAULT_LIST_EVENT_TYPE } from "./SetDefaultBanListCommand";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import {Mjolnir} from "../Mjolnir"; import {Mjolnir} from "../Mjolnir";
import {RichReply} from "matrix-bot-sdk"; import {RichReply} from "@vector-im/matrix-bot-sdk";
export async function execUnsuspendCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execUnsuspendCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {
const target = parts[2]; const target = parts[2];

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { Permalinks, RichReply } from "matrix-bot-sdk"; import { Permalinks, RichReply } from "@vector-im/matrix-bot-sdk";
// !mjolnir watch <room alias or ID> // !mjolnir watch <room alias or ID>
export async function execWatchCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) { export async function execWatchCommand(roomId: string, event: any, mjolnir: Mjolnir, parts: string[]) {

View File

@ -16,7 +16,7 @@ limitations under the License.
import * as fs from "fs"; import * as fs from "fs";
import { load } from "js-yaml"; import { load } from "js-yaml";
import { MatrixClient, LogService } from "matrix-bot-sdk"; import { MatrixClient, LogService } from "@vector-im/matrix-bot-sdk";
import Config from "config"; import Config from "config";
export interface IHealthConfig { export interface IHealthConfig {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import * as http from "http"; import * as http from "http";
import { LogService } from "matrix-bot-sdk"; import { LogService } from "@vector-im/matrix-bot-sdk";
import { IConfig } from "../config"; import { IConfig } from "../config";
// allowed to use the global configuration since this is only intended to be used by `src/index.ts`. // allowed to use the global configuration since this is only intended to be used by `src/index.ts`.

View File

@ -25,7 +25,7 @@ import {
PantalaimonClient, PantalaimonClient,
RichConsoleLogger, RichConsoleLogger,
SimpleFsStorageProvider SimpleFsStorageProvider
} from "matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import { read as configRead } from "./config"; import { read as configRead } from "./config";
import { Mjolnir } from "./Mjolnir"; import { Mjolnir } from "./Mjolnir";

View File

@ -16,7 +16,7 @@ limitations under the License.
import PolicyList, { ChangeType, ListRuleChange } from "./PolicyList"; import PolicyList, { ChangeType, ListRuleChange } from "./PolicyList";
import { EntityType, ListRule, Recommendation, RULE_SERVER, RULE_USER } from "./ListRule"; import { EntityType, ListRule, Recommendation, RULE_SERVER, RULE_USER } from "./ListRule";
import { LogService, UserID } from "matrix-bot-sdk"; import { LogService, UserID } from "@vector-im/matrix-bot-sdk";
import { ServerAcl } from "./ServerAcl"; import { ServerAcl } from "./ServerAcl";
/** /**

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixGlob } from "matrix-bot-sdk"; import { MatrixGlob } from "@vector-im/matrix-bot-sdk";
export enum EntityType { export enum EntityType {
/// `entity` is to be parsed as a glob of users IDs /// `entity` is to be parsed as a glob of users IDs

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { extractRequestError, LogLevel, LogService, Permalinks, RoomCreateOptions, UserID } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService, Permalinks, RoomCreateOptions, UserID } from "@vector-im/matrix-bot-sdk";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import { ALL_RULE_TYPES, EntityType, ListRule, Recommendation, ROOM_RULE_TYPES, RULE_ROOM, RULE_SERVER, RULE_USER, SERVER_RULE_TYPES, USER_RULE_TYPES } from "./ListRule"; import { ALL_RULE_TYPES, EntityType, ListRule, Recommendation, ROOM_RULE_TYPES, RULE_ROOM, RULE_SERVER, RULE_USER, SERVER_RULE_TYPES, USER_RULE_TYPES } from "./ListRule";
import { MatrixSendClient } from "../MatrixEmitter"; import { MatrixSendClient } from "../MatrixEmitter";

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
import BanList, { ChangeType, ListRuleChange } from "./PolicyList" import BanList, { ChangeType, ListRuleChange } from "./PolicyList"
import * as crypto from "crypto"; import * as crypto from "crypto";
import { LogService } from "matrix-bot-sdk"; import { LogService } from "@vector-im/matrix-bot-sdk";
import { EntityType, ListRule } from "./ListRule"; import { EntityType, ListRule } from "./ListRule";
import PolicyList from "./PolicyList"; import PolicyList from "./PolicyList";

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixGlob } from "matrix-bot-sdk"; import { MatrixGlob } from "@vector-im/matrix-bot-sdk";
import { setToArray } from "../utils"; import { setToArray } from "../utils";
export interface ServerAclContent { export interface ServerAclContent {

View File

@ -17,7 +17,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { NumberProtectionSetting } from "./ProtectionSettings"; import { NumberProtectionSetting } from "./ProtectionSettings";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, LogService } from "matrix-bot-sdk"; import { LogLevel, LogService } from "@vector-im/matrix-bot-sdk";
// if this is exceeded, we'll ban the user for spam and redact their messages // if this is exceeded, we'll ban the user for spam and redact their messages
export const DEFAULT_MAX_PER_MINUTE = 10; export const DEFAULT_MAX_PER_MINUTE = 10;

View File

@ -17,7 +17,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { DurationMSProtectionSetting, NumberProtectionSetting, StringSetProtectionSetting } from "./ProtectionSettings"; import { DurationMSProtectionSetting, NumberProtectionSetting, StringSetProtectionSetting } from "./ProtectionSettings";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, UserID } from "matrix-bot-sdk"; import { LogLevel, UserID } from "@vector-im/matrix-bot-sdk";
const DEFAULT_BUCKET_DURATION_MS = 10_000; const DEFAULT_BUCKET_DURATION_MS = 10_000;
const DEFAULT_BUCKET_NUMBER = 6; const DEFAULT_BUCKET_NUMBER = 6;

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, LogService } from "matrix-bot-sdk"; import { LogLevel, LogService } from "@vector-im/matrix-bot-sdk";
import { isTrueJoinEvent } from "../utils"; import { isTrueJoinEvent } from "../utils";
export class FirstMessageIsImage extends Protection { export class FirstMessageIsImage extends Protection {

View File

@ -17,7 +17,7 @@ limitations under the License.
import {Protection} from "./IProtection"; import {Protection} from "./IProtection";
import {Mjolnir} from "../Mjolnir"; import {Mjolnir} from "../Mjolnir";
import {NumberProtectionSetting} from "./ProtectionSettings"; import {NumberProtectionSetting} from "./ProtectionSettings";
import {LogLevel} from "matrix-bot-sdk"; import {LogLevel} from "@vector-im/matrix-bot-sdk";
const DEFAULT_MAX_PER_TIMESCALE = 50; const DEFAULT_MAX_PER_TIMESCALE = 50;
const DEFAULT_TIMESCALE_MINUTES = 60; const DEFAULT_TIMESCALE_MINUTES = 60;

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { LogLevel } from "matrix-bot-sdk"; import { LogLevel } from "@vector-im/matrix-bot-sdk";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, Permalinks, UserID } from "matrix-bot-sdk"; import { LogLevel, Permalinks, UserID } from "@vector-im/matrix-bot-sdk";
export class MessageIsMedia extends Protection { export class MessageIsMedia extends Protection {

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, Permalinks, UserID } from "matrix-bot-sdk"; import { LogLevel, Permalinks, UserID } from "@vector-im/matrix-bot-sdk";
export class MessageIsVoice extends Protection { export class MessageIsVoice extends Protection {

View File

@ -17,7 +17,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import * as nsfw from 'nsfwjs'; import * as nsfw from 'nsfwjs';
import {LogLevel} from "matrix-bot-sdk"; import {LogLevel} from "@vector-im/matrix-bot-sdk";
import { node } from '@tensorflow/tfjs-node'; import { node } from '@tensorflow/tfjs-node';

View File

@ -24,7 +24,7 @@ import { MessageIsMedia } from "./MessageIsMedia";
import { TrustedReporters } from "./TrustedReporters"; import { TrustedReporters } from "./TrustedReporters";
import { JoinWaveShortCircuit } from "./JoinWaveShortCircuit"; import { JoinWaveShortCircuit } from "./JoinWaveShortCircuit";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { extractRequestError, LogLevel, LogService, Permalinks } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService, Permalinks } from "@vector-im/matrix-bot-sdk";
import { ProtectionSettingValidationError } from "./ProtectionSettings"; import { ProtectionSettingValidationError } from "./ProtectionSettings";
import { Consequence } from "./consequence"; import { Consequence } from "./consequence";
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";

View File

@ -17,7 +17,7 @@ limitations under the License.
import { Protection } from "./IProtection"; import { Protection } from "./IProtection";
import { ConsequenceBan, ConsequenceRedact } from "./consequence"; import { ConsequenceBan, ConsequenceRedact } from "./consequence";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
import { LogLevel, LogService } from "matrix-bot-sdk"; import { LogLevel, LogService } from "@vector-im/matrix-bot-sdk";
import { isTrueJoinEvent } from "../utils"; import { isTrueJoinEvent } from "../utils";
export class WordList extends Protection { export class WordList extends Protection {

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { LogLevel, MatrixClient } from "matrix-bot-sdk" import { LogLevel, MatrixClient } from "@vector-im/matrix-bot-sdk"
import { ERROR_KIND_FATAL } from "../ErrorCache"; import { ERROR_KIND_FATAL } from "../ErrorCache";
import { RoomUpdateError } from "../models/RoomUpdateError"; import { RoomUpdateError } from "../models/RoomUpdateError";
import { redactUserMessagesIn } from "../utils"; import { redactUserMessagesIn } from "../utils";

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { extractRequestError, LogLevel } from "matrix-bot-sdk"; import { extractRequestError, LogLevel } from "@vector-im/matrix-bot-sdk";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
export type Task<T> = (queue: ThrottlingQueue) => Promise<T>; export type Task<T> = (queue: ThrottlingQueue) => Promise<T>;

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { extractRequestError, LogLevel, LogService, Permalinks } from "matrix-bot-sdk"; import { extractRequestError, LogLevel, LogService, Permalinks } from "@vector-im/matrix-bot-sdk";
import { Mjolnir } from "../Mjolnir"; import { Mjolnir } from "../Mjolnir";
/** /**

View File

@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { PowerLevelAction } from "matrix-bot-sdk/lib/models/PowerLevelAction"; import { PowerLevelAction } from "@vector-im/matrix-bot-sdk/lib/models/PowerLevelAction";
import { LogService, UserID } from "matrix-bot-sdk"; import { LogService, UserID } from "@vector-im/matrix-bot-sdk";
import { htmlToText } from "html-to-text"; import { htmlToText } from "html-to-text";
import { htmlEscape } from "../utils"; import { htmlEscape } from "../utils";
import { JSDOM } from 'jsdom'; import { JSDOM } from 'jsdom';

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Mjolnir, REPORT_POLL_EVENT_TYPE } from "../Mjolnir"; import { Mjolnir, REPORT_POLL_EVENT_TYPE } from "../Mjolnir";
import { ReportManager } from './ReportManager'; import { ReportManager } from './ReportManager';
import { LogLevel } from "matrix-bot-sdk"; import { LogLevel } from "@vector-im/matrix-bot-sdk";
class InvalidStateError extends Error { } class InvalidStateError extends Error { }

View File

@ -20,7 +20,7 @@ import {
MatrixGlob, MatrixGlob,
getRequestFn, getRequestFn,
setRequestFn, setRequestFn,
} from "matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import { ClientRequest, IncomingMessage } from "http"; import { ClientRequest, IncomingMessage } from "http";
import { default as parseDuration } from "parse-duration"; import { default as parseDuration } from "parse-duration";
import * as Sentry from '@sentry/node'; import * as Sentry from '@sentry/node';

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Server } from "http"; import { Server } from "http";
import express from "express"; import express from "express";
import { LogService } from "matrix-bot-sdk"; import { LogService } from "@vector-im/matrix-bot-sdk";
import { IHealthConfig } from "../config"; import { IHealthConfig } from "../config";
import { collectDefaultMetrics, register } from "prom-client"; import { collectDefaultMetrics, register } from "prom-client";

View File

@ -16,7 +16,7 @@ limitations under the License.
import { Server } from "http"; import { Server } from "http";
import express from "express"; import express from "express";
import { LogService, MatrixClient } from "matrix-bot-sdk"; import { LogService, MatrixClient } from "@vector-im/matrix-bot-sdk";
import RuleServer from "../models/RuleServer"; import RuleServer from "../models/RuleServer";
import { ReportManager } from "../report/ReportManager"; import { ReportManager } from "../report/ReportManager";
import { IConfig } from "../config"; import { IConfig } from "../config";

View File

@ -1,7 +1,7 @@
import { isPolicyRoom, readTestConfig, setupHarness } from "../utils/harness"; import { isPolicyRoom, readTestConfig, setupHarness } from "../utils/harness";
import { newTestUser } from "../../integration/clientHelper"; import { newTestUser } from "../../integration/clientHelper";
import { getFirstReply } from "../../integration/commands/commandUtils"; import { getFirstReply } from "../../integration/commands/commandUtils";
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { MjolnirAppService } from "../../../src/appservice/AppService"; import { MjolnirAppService } from "../../../src/appservice/AppService";
import dns from 'node:dns'; import dns from 'node:dns';

View File

@ -2,7 +2,7 @@ import { MjolnirAppService } from "../../../src/appservice/AppService";
import { newTestUser } from "../../integration/clientHelper"; import { newTestUser } from "../../integration/clientHelper";
import { isPolicyRoom, readTestConfig, setupHarness } from "../utils/harness"; import { isPolicyRoom, readTestConfig, setupHarness } from "../utils/harness";
import { CreateMjolnirResponse, MjolnirWebAPIClient } from "../utils/webAPIClient"; import { CreateMjolnirResponse, MjolnirWebAPIClient } from "../utils/webAPIClient";
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { getFirstReply } from "../../integration/commands/commandUtils"; import { getFirstReply } from "../../integration/commands/commandUtils";
import expect from "expect"; import expect from "expect";
import dns from 'node:dns'; import dns from 'node:dns';

View File

@ -4,7 +4,7 @@ import { ensureAliasedRoomExists } from "../../integration/mjolnirSetupUtils";
import { read as configRead, IConfig } from "../../../src/appservice/config/config"; import { read as configRead, IConfig } from "../../../src/appservice/config/config";
import { newTestUser } from "../../integration/clientHelper"; import { newTestUser } from "../../integration/clientHelper";
import PolicyList from "../../../src/models/PolicyList"; import PolicyList from "../../../src/models/PolicyList";
import { CreateEvent, MatrixClient } from "matrix-bot-sdk"; import { CreateEvent, MatrixClient } from "@vector-im/matrix-bot-sdk";
export function readTestConfig(): IConfig { export function readTestConfig(): IConfig {
return configRead(path.join(__dirname, "../../../src/appservice/config/config.harness.yaml")); return configRead(path.join(__dirname, "../../../src/appservice/config/config.harness.yaml"));

View File

@ -1,5 +1,5 @@
import * as request from "request"; import * as request from "request";
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
interface OpenIDTokenInfo { interface OpenIDTokenInfo {
access_token: string, access_token: string,

View File

@ -1,4 +1,4 @@
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { Mjolnir } from "../../src/Mjolnir" import { Mjolnir } from "../../src/Mjolnir"
import { newTestUser } from "./clientHelper"; import { newTestUser } from "./clientHelper";

View File

@ -1,6 +1,6 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { newTestUser } from "./clientHelper"; import { newTestUser } from "./clientHelper";
import { LogService, MatrixClient, Permalinks, UserID } from "matrix-bot-sdk"; import { LogService, MatrixClient, Permalinks, UserID } from "@vector-im/matrix-bot-sdk";
import PolicyList, { ChangeType } from "../../src/models/PolicyList"; import PolicyList, { ChangeType } from "../../src/models/PolicyList";
import { ServerAcl } from "../../src/models/ServerAcl"; import { ServerAcl } from "../../src/models/ServerAcl";
import { getFirstReaction } from "./commands/commandUtils"; import { getFirstReaction } from "./commands/commandUtils";

View File

@ -1,5 +1,5 @@
import { HmacSHA1 } from "crypto-js"; import { HmacSHA1 } from "crypto-js";
import { getRequestFn, LogService, MatrixClient, MemoryStorageProvider, PantalaimonClient } from "matrix-bot-sdk"; import { getRequestFn, LogService, MatrixClient, MemoryStorageProvider, PantalaimonClient } from "@vector-im/matrix-bot-sdk";
const REGISTRATION_ATTEMPTS = 10; const REGISTRATION_ATTEMPTS = 10;
const REGISTRATION_RETRY_BASE_DELAY_MS = 100; const REGISTRATION_RETRY_BASE_DELAY_MS = 100;

View File

@ -1,4 +1,4 @@
import { MatrixClient } from "matrix-bot-sdk"; import { MatrixClient } from "@vector-im/matrix-bot-sdk";
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import * as crypto from "crypto"; import * as crypto from "crypto";
import { MatrixEmitter } from "../../../src/MatrixEmitter"; import { MatrixEmitter } from "../../../src/MatrixEmitter";

View File

@ -2,7 +2,7 @@
import { newTestUser } from "../clientHelper"; import { newTestUser } from "../clientHelper";
import { PowerLevelAction } from "matrix-bot-sdk/lib/models/PowerLevelAction"; import { PowerLevelAction } from "matrix-bot-sdk/lib/models/PowerLevelAction";
import { LogService } from "matrix-bot-sdk"; import { LogService } from "@vector-im/matrix-bot-sdk";
import { getFirstReaction } from "./commandUtils"; import { getFirstReaction } from "./commandUtils";
describe("Test: The make admin command", function () { describe("Test: The make admin command", function () {

View File

@ -2,7 +2,7 @@ import { strict as assert } from "assert";
import { newTestUser } from "../clientHelper"; import { newTestUser } from "../clientHelper";
import { getMessagesByUserIn } from "../../../src/utils"; import { getMessagesByUserIn } from "../../../src/utils";
import { LogService } from "matrix-bot-sdk"; import { LogService } from "@vector-im/matrix-bot-sdk";
import { getFirstReaction } from "./commandUtils"; import { getFirstReaction } from "./commandUtils";
describe("Test: The redaction command", function () { describe("Test: The redaction command", function () {

View File

@ -16,7 +16,7 @@ limitations under the License.
import {newTestUser} from "../clientHelper"; import {newTestUser} from "../clientHelper";
import {strict as assert} from "assert"; import {strict as assert} from "assert";
import { MatrixClient, RoomCreateOptions } from "matrix-bot-sdk"; import { MatrixClient, RoomCreateOptions } from "@vector-im/matrix-bot-sdk";
import { read as configRead } from "../../../src/config"; import { read as configRead } from "../../../src/config";
describe("Test: suspend/unsuspend command", function () { describe("Test: suspend/unsuspend command", function () {

View File

@ -1,6 +1,6 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { UserID } from "matrix-bot-sdk"; import { UserID } from "@vector-im/matrix-bot-sdk";
import { Suite } from "mocha"; import { Suite } from "mocha";
import { Mjolnir } from "../../src/Mjolnir"; import { Mjolnir } from "../../src/Mjolnir";
import { DetectFederationLag, LAG_STATE_EVENT } from "../../src/protections/DetectFederationLag"; import { DetectFederationLag, LAG_STATE_EVENT } from "../../src/protections/DetectFederationLag";

View File

@ -20,7 +20,7 @@ import {
LogService, LogService,
LogLevel, LogLevel,
RichConsoleLogger RichConsoleLogger
} from "matrix-bot-sdk"; } from "@vector-im/matrix-bot-sdk";
import { Mjolnir} from '../../src/Mjolnir'; import { Mjolnir} from '../../src/Mjolnir';
import { overrideRatelimitForUser, registerUser } from "./clientHelper"; import { overrideRatelimitForUser, registerUser } from "./clientHelper";

View File

@ -1,6 +1,6 @@
import {newTestUser} from "./clientHelper"; import {newTestUser} from "./clientHelper";
import {MatrixClient} from "matrix-bot-sdk"; import {MatrixClient} from "@vector-im/matrix-bot-sdk";
import {getFirstReaction} from "./commands/commandUtils"; import {getFirstReaction} from "./commands/commandUtils";
import {strict as assert} from "assert"; import {strict as assert} from "assert";
import { readFileSync } from 'fs'; import { readFileSync } from 'fs';

View File

@ -1,5 +1,5 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { getRequestFn } from "matrix-bot-sdk"; import { getRequestFn } from "@vector-im/matrix-bot-sdk";
import { IConfig } from "../../src/config"; import { IConfig } from "../../src/config";

View File

@ -3,7 +3,7 @@ import { strict as assert } from "assert";
import { newTestUser } from "./clientHelper"; import { newTestUser } from "./clientHelper";
import { Mjolnir } from "../../src/Mjolnir"; import { Mjolnir } from "../../src/Mjolnir";
import { read as configRead } from "../../src/config"; import { read as configRead } from "../../src/config";
import { getRequestFn, LogService } from "matrix-bot-sdk"; import { getRequestFn, LogService } from "@vector-im/matrix-bot-sdk";
import { createBanList, getFirstReaction } from "./commands/commandUtils"; import { createBanList, getFirstReaction } from "./commands/commandUtils";
/** /**

View File

@ -1,6 +1,6 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { MatrixClient, Permalinks, UserID } from "matrix-bot-sdk"; import { MatrixClient, Permalinks, UserID } from "@vector-im/matrix-bot-sdk";
import { MatrixSendClient } from "../../src/MatrixEmitter"; import { MatrixSendClient } from "../../src/MatrixEmitter";
import { Mjolnir } from "../../src/Mjolnir"; import { Mjolnir } from "../../src/Mjolnir";
import PolicyList from "../../src/models/PolicyList"; import PolicyList from "../../src/models/PolicyList";

View File

@ -1,6 +1,6 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { UserID } from "matrix-bot-sdk"; import { UserID } from "@vector-im/matrix-bot-sdk";
import { ThrottlingQueue } from "../../src/queues/ThrottlingQueue"; import { ThrottlingQueue } from "../../src/queues/ThrottlingQueue";
describe("Test: ThrottlingQueue", function() { describe("Test: ThrottlingQueue", function() {

View File

@ -1,5 +1,5 @@
import { strict as assert } from "assert"; import { strict as assert } from "assert";
import { LogLevel } from "matrix-bot-sdk"; import { LogLevel } from "@vector-im/matrix-bot-sdk";
import ManagementRoomOutput from "../../src/ManagementRoomOutput"; import ManagementRoomOutput from "../../src/ManagementRoomOutput";
describe("Test: utils", function() { describe("Test: utils", function() {