[core+console] Raise deprecation level for 2.14, API including:

- EventChannel.asChannel
- (internal) syncFromEventImpl
- EmptyMessageChain
- GroupEntranceAnnouncementChangeEvent
- MiraiConsole.createLogger
- SingletonExtensionPoint
This commit is contained in:
Him188 2022-12-27 15:39:12 +00:00
parent 76a70f596f
commit 7908edb57b
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
25 changed files with 93 additions and 273 deletions

View File

@ -1565,18 +1565,13 @@ public final class net/mamoe/mirai/console/extension/PluginComponentStorage {
public fun <init> (Lnet/mamoe/mirai/console/plugin/Plugin;)V public fun <init> (Lnet/mamoe/mirai/console/plugin/Plugin;)V
public final fun contribute (Lnet/mamoe/mirai/console/extension/ExtensionPoint;Lkotlin/jvm/functions/Function0;)V public final fun contribute (Lnet/mamoe/mirai/console/extension/ExtensionPoint;Lkotlin/jvm/functions/Function0;)V
public final fun contributeBotConfigurationAlterer (Lnet/mamoe/mirai/console/extensions/BotConfigurationAlterer;)V public final fun contributeBotConfigurationAlterer (Lnet/mamoe/mirai/console/extensions/BotConfigurationAlterer;)V
public final fun contributeCommandCallInterceptor (Lkotlin/jvm/functions/Function0;)V
public final fun contributeCommandCallInterceptorProvider (Lnet/mamoe/mirai/console/extensions/CommandCallInterceptorProvider;)V public final fun contributeCommandCallInterceptorProvider (Lnet/mamoe/mirai/console/extensions/CommandCallInterceptorProvider;)V
public final fun contributeCommandCallParser (Lkotlin/jvm/functions/Function0;)V
public final fun contributeCommandCallParserProvider (Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider;)V public final fun contributeCommandCallParserProvider (Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider;)V
public final fun contributeCommandCallResolver (Lkotlin/jvm/functions/Function0;)V
public final fun contributeCommandCallResolverProvider (Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider;)V public final fun contributeCommandCallResolverProvider (Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider;)V
public final fun contributePermissionService (Lkotlin/jvm/functions/Function0;)V
public final fun contributePermissionServiceProvider (Lkotlin/jvm/functions/Function0;)V public final fun contributePermissionServiceProvider (Lkotlin/jvm/functions/Function0;)V
public final fun contributePluginLoader (Lkotlin/jvm/functions/Function0;)V
public final fun contributePluginLoaderProvider (Lkotlin/jvm/functions/Function0;)V public final fun contributePluginLoaderProvider (Lkotlin/jvm/functions/Function0;)V
public final fun contributePostStartupExtension (Lnet/mamoe/mirai/console/extensions/PostStartupExtension;)V public final fun contributePostStartupExtension (Lnet/mamoe/mirai/console/extensions/PostStartupExtension;)V
public final fun contributeSingletonExtensionSelector (Lkotlin/jvm/functions/Function0;)V public final synthetic fun contributeSingletonExtensionSelector (Lkotlin/jvm/functions/Function0;)V
public final fun runAfterStartup (Lkotlin/jvm/functions/Function0;)V public final fun runAfterStartup (Lkotlin/jvm/functions/Function0;)V
} }
@ -1602,18 +1597,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallIn
public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint {
} }
public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProviderImpl : net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider {
public fun <init> (Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor;
}
public final class net/mamoe/mirai/console/extensions/CommandCallInterceptorProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallInterceptorProvider {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallInterceptor;
}
public abstract interface class net/mamoe/mirai/console/extensions/CommandCallParserProvider : net/mamoe/mirai/console/extension/InstanceExtension { public abstract interface class net/mamoe/mirai/console/extensions/CommandCallParserProvider : net/mamoe/mirai/console/extension/InstanceExtension {
public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint; public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint;
} }
@ -1621,18 +1604,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallPa
public final class net/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { public final class net/mamoe/mirai/console/extensions/CommandCallParserProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint {
} }
public final class net/mamoe/mirai/console/extensions/CommandCallParserProviderImpl : net/mamoe/mirai/console/extensions/CommandCallParserProvider {
public fun <init> (Lnet/mamoe/mirai/console/command/parse/CommandCallParser;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/parse/CommandCallParser;
}
public final class net/mamoe/mirai/console/extensions/CommandCallParserProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallParserProvider {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/parse/CommandCallParser;
}
public abstract interface class net/mamoe/mirai/console/extensions/CommandCallResolverProvider : net/mamoe/mirai/console/extension/InstanceExtension { public abstract interface class net/mamoe/mirai/console/extensions/CommandCallResolverProvider : net/mamoe/mirai/console/extension/InstanceExtension {
public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint; public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint;
} }
@ -1640,18 +1611,6 @@ public abstract interface class net/mamoe/mirai/console/extensions/CommandCallRe
public final class net/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint { public final class net/mamoe/mirai/console/extensions/CommandCallResolverProvider$ExtensionPoint : net/mamoe/mirai/console/extension/AbstractInstanceExtensionPoint {
} }
public final class net/mamoe/mirai/console/extensions/CommandCallResolverProviderImpl : net/mamoe/mirai/console/extensions/CommandCallResolverProvider {
public fun <init> (Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver;
}
public final class net/mamoe/mirai/console/extensions/CommandCallResolverProviderImplLazy : net/mamoe/mirai/console/extensions/CommandCallResolverProvider {
public fun <init> (Lkotlin/jvm/functions/Function0;)V
public synthetic fun getInstance ()Ljava/lang/Object;
public fun getInstance ()Lnet/mamoe/mirai/console/command/resolve/CommandCallResolver;
}
public abstract interface class net/mamoe/mirai/console/extensions/PermissionServiceProvider : net/mamoe/mirai/console/extension/InstanceExtension { public abstract interface class net/mamoe/mirai/console/extensions/PermissionServiceProvider : net/mamoe/mirai/console/extension/InstanceExtension {
public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/PermissionServiceProvider$ExtensionPoint; public static final field ExtensionPoint Lnet/mamoe/mirai/console/extensions/PermissionServiceProvider$ExtensionPoint;
} }

View File

@ -132,13 +132,13 @@ public interface MiraiConsole : CoroutineScope {
*/ */
@Deprecated( @Deprecated(
"Please use the standard way in mirai-core to create loggers, i.e. MiraiLogger.Factory.INSTANCE.create()", "Please use the standard way in mirai-core to create loggers, i.e. MiraiLogger.Factory.INSTANCE.create()",
level = DeprecationLevel.WARNING, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith( replaceWith = ReplaceWith(
"MiraiLogger.Factory.create(yourClass::class, identity)", "MiraiLogger.Factory.create(yourClass::class, identity)",
"net.mamoe.mirai.utils.MiraiLogger" "net.mamoe.mirai.utils.MiraiLogger"
), ),
) )
@DeprecatedSinceMirai(warningSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.13", errorSince = "2.14") // for removal
@ConsoleExperimentalApi @ConsoleExperimentalApi
public fun createLogger(identity: String?): MiraiLogger public fun createLogger(identity: String?): MiraiLogger

View File

@ -210,19 +210,6 @@ public interface MiraiConsoleImplementation : CoroutineScope {
*/ */
public fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver public fun createLoginSolver(requesterBot: Long, configuration: BotConfiguration): LoginSolver
/**
* 创建一个 [MiraiLogger].
*
* **注意**: [MiraiConsole] 会将 [net.mamoe.mirai.utils.MiraiLogger.Factory] 设置为 `MiraiConsole::createLogger`.
* 因此不要在 [createLogger] 中调用 [net.mamoe.mirai.utils.MiraiLogger.create]
*/
@Deprecated(
"Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(errorSince = "2.13")
public fun createLogger(identity: String?): MiraiLogger
/** @see [MiraiConsole.newProcessProgress] */ /** @see [MiraiConsole.newProcessProgress] */
public fun createNewProcessProgress(): ProcessProgress { public fun createNewProcessProgress(): ProcessProgress {
return DefaultLoggingProcessProgress() return DefaultLoggingProcessProgress()

View File

@ -41,8 +41,8 @@ import net.mamoe.mirai.utils.DeprecatedSinceMirai
@Deprecated( @Deprecated(
"请使用 JavaAutoSavePluginConfig", "请使用 JavaAutoSavePluginConfig",
replaceWith = ReplaceWith("JavaAutoSavePluginConfig", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginConfig"), replaceWith = ReplaceWith("JavaAutoSavePluginConfig", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginConfig"),
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public abstract class JAutoSavePluginConfig public constructor(saveName: String) : AutoSavePluginConfig(saveName), public abstract class JAutoSavePluginConfig public constructor(saveName: String) : AutoSavePluginConfig(saveName),
PluginConfig PluginConfig

View File

@ -73,9 +73,9 @@ import kotlin.reflect.full.createType
@Deprecated( @Deprecated(
"请使用 JavaAutoSavePluginData", "请使用 JavaAutoSavePluginData",
replaceWith = ReplaceWith("JavaAutoSavePluginData", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginData"), replaceWith = ReplaceWith("JavaAutoSavePluginData", "net.mamoe.mirai.console.data.java.JavaAutoSavePluginData"),
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public abstract class JAutoSavePluginData public constructor(saveName: String) : AutoSavePluginData(saveName), public abstract class JAutoSavePluginData public constructor(saveName: String) : AutoSavePluginData(saveName),
PluginConfig { PluginConfig {

View File

@ -66,9 +66,9 @@ public interface FunctionExtension : Extension
@Deprecated( @Deprecated(
"Please use InstanceExtension instead.", "Please use InstanceExtension instead.",
replaceWith = ReplaceWith("InstanceExtension"), replaceWith = ReplaceWith("InstanceExtension"),
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public interface SingletonExtension<T> : Extension { public interface SingletonExtension<T> : Extension {
public val instance: T public val instance: T
} }

View File

@ -42,9 +42,9 @@ public abstract class AbstractExtensionPoint<T : Extension>(
@Deprecated( @Deprecated(
"Please use InstanceExtensionPoint instead.", "Please use InstanceExtensionPoint instead.",
replaceWith = ReplaceWith("InstanceExtensionPoint"), replaceWith = ReplaceWith("InstanceExtensionPoint"),
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public interface SingletonExtensionPoint<T : SingletonExtension<*>> : ExtensionPoint<T> public interface SingletonExtensionPoint<T : SingletonExtension<*>> : ExtensionPoint<T>
/** /**
@ -73,9 +73,9 @@ public constructor(
"AbstractInstanceExtension", "AbstractInstanceExtension",
"net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint" "net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint"
), ),
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
@Suppress("DEPRECATION", "DEPRECATION_ERROR") @Suppress("DEPRECATION", "DEPRECATION_ERROR")
public abstract class AbstractSingletonExtensionPoint<E : SingletonExtension<T>, T> public abstract class AbstractSingletonExtensionPoint<E : SingletonExtension<T>, T>
/** /**

View File

@ -10,14 +10,9 @@
package net.mamoe.mirai.console.extension package net.mamoe.mirai.console.extension
import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
import net.mamoe.mirai.console.command.parse.CommandCallParser
import net.mamoe.mirai.console.command.resolve.CommandCallInterceptor
import net.mamoe.mirai.console.command.resolve.CommandCallResolver
import net.mamoe.mirai.console.extensions.* import net.mamoe.mirai.console.extensions.*
import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage import net.mamoe.mirai.console.internal.extension.AbstractConcurrentComponentStorage
import net.mamoe.mirai.console.permission.PermissionService
import net.mamoe.mirai.console.plugin.Plugin import net.mamoe.mirai.console.plugin.Plugin
import net.mamoe.mirai.console.plugin.loader.PluginLoader
import net.mamoe.mirai.utils.DeprecatedSinceMirai import net.mamoe.mirai.utils.DeprecatedSinceMirai
import kotlin.reflect.full.companionObjectInstance import kotlin.reflect.full.companionObjectInstance
@ -57,15 +52,15 @@ public class PluginComponentStorage(
// FunctionExtension // FunctionExtension
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/** 注册一个 [SingletonExtensionSelector] */ /** 注册一个 [net.mamoe.mirai.console.extensions.SingletonExtensionSelector] */
@Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION_ERROR") @Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION_ERROR", "DEPRECATION")
@Deprecated( @Deprecated(
"Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public fun contributeSingletonExtensionSelector(lazyInstance: () -> SingletonExtensionSelector): Unit = public fun contributeSingletonExtensionSelector(lazyInstance: () -> net.mamoe.mirai.console.extensions.SingletonExtensionSelector): Unit =
contribute(SingletonExtensionSelector, plugin, lazyInstance) contribute(net.mamoe.mirai.console.extensions.SingletonExtensionSelector.ExtensionPoint, plugin, lazyInstance)
/** 注册一个 [BotConfigurationAlterer] */ /** 注册一个 [BotConfigurationAlterer] */
public fun contributeBotConfigurationAlterer(instance: BotConfigurationAlterer): Unit = public fun contributeBotConfigurationAlterer(instance: BotConfigurationAlterer): Unit =
@ -82,17 +77,6 @@ public class PluginComponentStorage(
// InstanceExtensions & SingletonExtensions // InstanceExtensions & SingletonExtensions
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/** 注册一个 [PermissionServiceProvider] */
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributePermissionService(provider).",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@OverloadResolutionByLambdaReturnType
public fun contributePermissionService(lazyInstance: () -> PermissionService<*>): Unit =
contribute(PermissionServiceProvider, plugin, PermissionServiceProviderImplLazy(lazyInstance))
/** 注册一个 [PermissionServiceProvider] */ /** 注册一个 [PermissionServiceProvider] */
@JvmName("contributePermissionServiceProvider") @JvmName("contributePermissionServiceProvider")
@OverloadResolutionByLambdaReturnType @OverloadResolutionByLambdaReturnType
@ -101,17 +85,6 @@ public class PluginComponentStorage(
///////////////////////////////////// /////////////////////////////////////
/** 注册一个 [PluginLoaderProvider] */
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributePluginLoader(provider).",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@OverloadResolutionByLambdaReturnType
public fun contributePluginLoader(lazyInstance: () -> PluginLoader<*, *>): Unit =
contribute(PluginLoaderProvider, plugin, PluginLoaderProviderImplLazy(lazyInstance))
/** 注册一个 [PluginLoaderProvider] */ /** 注册一个 [PluginLoaderProvider] */
@JvmName("contributePluginLoaderProvider") @JvmName("contributePluginLoaderProvider")
@OverloadResolutionByLambdaReturnType @OverloadResolutionByLambdaReturnType
@ -120,17 +93,6 @@ public class PluginComponentStorage(
///////////////////////////////////// /////////////////////////////////////
/** 注册一个 [CommandCallParserProvider] */
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallParser(provider).",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
@OverloadResolutionByLambdaReturnType
public fun contributeCommandCallParser(lazyInstance: () -> CommandCallParser): Unit =
contribute(CommandCallParserProvider, plugin, CommandCallParserProviderImplLazy(lazyInstance))
/** 注册一个 [CommandCallParserProvider] */ /** 注册一个 [CommandCallParserProvider] */
@ExperimentalCommandDescriptors @ExperimentalCommandDescriptors
@ -142,17 +104,6 @@ public class PluginComponentStorage(
///////////////////////////////////// /////////////////////////////////////
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallResolver(provider).",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
@OverloadResolutionByLambdaReturnType
public fun contributeCommandCallResolver(lazyInstance: () -> CommandCallResolver): Unit =
contribute(CommandCallResolverProvider, plugin, CommandCallResolverProviderImplLazy(lazyInstance))
/** 注册一个 [CommandCallResolverProvider] */ /** 注册一个 [CommandCallResolverProvider] */
@ExperimentalCommandDescriptors @ExperimentalCommandDescriptors
@JvmName("contributeCommandCallResolverProvider") @JvmName("contributeCommandCallResolverProvider")
@ -162,18 +113,6 @@ public class PluginComponentStorage(
///////////////////////////////////// /////////////////////////////////////
/** 注册一个 [CommandCallInterceptorProvider] */
@Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider, and use contributeCommandCallInterceptor(provider).",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
@OverloadResolutionByLambdaReturnType
public fun contributeCommandCallInterceptor(lazyInstance: () -> CommandCallInterceptor): Unit =
contribute(CommandCallInterceptorProvider, plugin, CommandCallInterceptorProviderImplLazy(lazyInstance))
/** 注册一个 [CommandCallInterceptorProvider] */ /** 注册一个 [CommandCallInterceptorProvider] */
@ExperimentalCommandDescriptors @ExperimentalCommandDescriptors
@JvmName("contributeCommandCallInterceptorProvider") @JvmName("contributeCommandCallInterceptorProvider")

View File

@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
import net.mamoe.mirai.console.command.resolve.CommandCallInterceptor import net.mamoe.mirai.console.command.resolve.CommandCallInterceptor
import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint
import net.mamoe.mirai.console.extension.InstanceExtension import net.mamoe.mirai.console.extension.InstanceExtension
import net.mamoe.mirai.utils.DeprecatedSinceMirai
@ExperimentalCommandDescriptors @ExperimentalCommandDescriptors
public interface CommandCallInterceptorProvider : InstanceExtension<CommandCallInterceptor> { public interface CommandCallInterceptorProvider : InstanceExtension<CommandCallInterceptor> {
@ -22,24 +21,4 @@ public interface CommandCallInterceptorProvider : InstanceExtension<CommandCallI
AbstractInstanceExtensionPoint<CommandCallInterceptorProvider, CommandCallInterceptor>( AbstractInstanceExtensionPoint<CommandCallInterceptorProvider, CommandCallInterceptor>(
CommandCallInterceptorProvider::class CommandCallInterceptorProvider::class
) )
}
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallInterceptorProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallInterceptorProviderImpl(override val instance: CommandCallInterceptor) :
CommandCallInterceptorProvider
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallInterceptorProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallInterceptorProviderImplLazy(initializer: () -> CommandCallInterceptor) :
CommandCallInterceptorProvider {
override val instance: CommandCallInterceptor by lazy(initializer)
} }

View File

@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
import net.mamoe.mirai.console.command.parse.CommandCallParser import net.mamoe.mirai.console.command.parse.CommandCallParser
import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint
import net.mamoe.mirai.console.extension.InstanceExtension import net.mamoe.mirai.console.extension.InstanceExtension
import net.mamoe.mirai.utils.DeprecatedSinceMirai
/** /**
* The provider of [CommandCallParser] * The provider of [CommandCallParser]
@ -24,21 +23,3 @@ public interface CommandCallParserProvider : InstanceExtension<CommandCallParser
public companion object ExtensionPoint : public companion object ExtensionPoint :
AbstractInstanceExtensionPoint<CommandCallParserProvider, CommandCallParser>(CommandCallParserProvider::class) AbstractInstanceExtensionPoint<CommandCallParserProvider, CommandCallParser>(CommandCallParserProvider::class)
} }
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallParserProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallParserProviderImpl(override val instance: CommandCallParser) : CommandCallParserProvider
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallParserProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallParserProviderImplLazy(initializer: () -> CommandCallParser) : CommandCallParserProvider {
override val instance: CommandCallParser by lazy(initializer)
}

View File

@ -13,7 +13,6 @@ import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
import net.mamoe.mirai.console.command.resolve.CommandCallResolver import net.mamoe.mirai.console.command.resolve.CommandCallResolver
import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint import net.mamoe.mirai.console.extension.AbstractInstanceExtensionPoint
import net.mamoe.mirai.console.extension.InstanceExtension import net.mamoe.mirai.console.extension.InstanceExtension
import net.mamoe.mirai.utils.DeprecatedSinceMirai
@ExperimentalCommandDescriptors @ExperimentalCommandDescriptors
public interface CommandCallResolverProvider : InstanceExtension<CommandCallResolver> { public interface CommandCallResolverProvider : InstanceExtension<CommandCallResolver> {
@ -22,21 +21,3 @@ public interface CommandCallResolverProvider : InstanceExtension<CommandCallReso
public companion object ExtensionPoint : public companion object ExtensionPoint :
AbstractInstanceExtensionPoint<CommandCallResolverProvider, CommandCallResolver>(CommandCallResolverProvider::class) AbstractInstanceExtensionPoint<CommandCallResolverProvider, CommandCallResolver>(CommandCallResolverProvider::class)
} }
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallResolverProviderImpl(override val instance: CommandCallResolver) : CommandCallResolverProvider
@Deprecated(
"Deprecated for removal. Please implement your own CommandCallResolverProvider.",
level = DeprecationLevel.ERROR
)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for removal.
@ExperimentalCommandDescriptors
public class CommandCallResolverProviderImplLazy(initializer: () -> CommandCallResolver) : CommandCallResolverProvider {
override val instance: CommandCallResolver by lazy(initializer)
}

View File

@ -29,15 +29,15 @@ public interface PermissionServiceProvider : InstanceExtension<PermissionService
/** /**
* @see PermissionServiceProvider * @see PermissionServiceProvider
*/ */
@Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.ERROR) @Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.HIDDEN)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden.
public class PermissionServiceProviderImpl(override val instance: PermissionService<*>) : PermissionServiceProvider public class PermissionServiceProviderImpl(override val instance: PermissionService<*>) : PermissionServiceProvider
/** /**
* @see PermissionServiceProvider * @see PermissionServiceProvider
*/ */
@Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.ERROR) @Deprecated("Please implement your own PermissionServiceProvider.", level = DeprecationLevel.HIDDEN)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden.
public class PermissionServiceProviderImplLazy(initializer: () -> PermissionService<*>) : PermissionServiceProvider { public class PermissionServiceProviderImplLazy(initializer: () -> PermissionService<*>) : PermissionServiceProvider {
override val instance: PermissionService<*> by lazy(initializer) override val instance: PermissionService<*> by lazy(initializer)
} }

View File

@ -31,12 +31,12 @@ public interface PluginLoaderProvider : InstanceExtension<PluginLoader<*, *>> {
public companion object ExtensionPoint : AbstractExtensionPoint<PluginLoaderProvider>(PluginLoaderProvider::class) public companion object ExtensionPoint : AbstractExtensionPoint<PluginLoaderProvider>(PluginLoaderProvider::class)
} }
@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.ERROR) @Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.HIDDEN)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden.
public class PluginLoaderProviderImpl(override val instance: PluginLoader<*, *>) : PluginLoaderProvider public class PluginLoaderProviderImpl(override val instance: PluginLoader<*, *>) : PluginLoaderProvider
@Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.ERROR) @Deprecated("Please implement your own PluginLoaderProvider.", level = DeprecationLevel.HIDDEN)
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") // for hidden. @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14") // for hidden.
public class PluginLoaderProviderImplLazy(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider { public class PluginLoaderProviderImplLazy(initializer: () -> PluginLoader<*, *>) : PluginLoaderProvider {
override val instance: PluginLoader<*, *> by lazy(initializer) override val instance: PluginLoader<*, *> by lazy(initializer)
} }

View File

@ -28,9 +28,9 @@ import kotlin.reflect.KClass
*/ */
@Deprecated( @Deprecated(
"Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
public interface SingletonExtensionSelector : FunctionExtension { public interface SingletonExtensionSelector : FunctionExtension {
/** /**
@ -38,9 +38,9 @@ public interface SingletonExtensionSelector : FunctionExtension {
*/ */
@Deprecated( @Deprecated(
"Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public data class Registry<T : Extension>( public data class Registry<T : Extension>(
val plugin: Plugin?, val plugin: Plugin?,
val extension: T, val extension: T,
@ -56,9 +56,9 @@ public interface SingletonExtensionSelector : FunctionExtension {
@Deprecated( @Deprecated(
"Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", "Order of extensions is now determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
public companion object ExtensionPoint : public companion object ExtensionPoint :
AbstractExtensionPoint<SingletonExtensionSelector>(SingletonExtensionSelector::class) { AbstractExtensionPoint<SingletonExtensionSelector>(SingletonExtensionSelector::class) {
@ -68,7 +68,7 @@ public interface SingletonExtensionSelector : FunctionExtension {
internal fun init() { internal fun init() {
check(instanceField == null) { "Internal error: reinitialize SingletonExtensionSelector" } check(instanceField == null) { "Internal error: reinitialize SingletonExtensionSelector" }
val instances = GlobalComponentStorage.getExtensions(ExtensionPoint).toList() val instances = GlobalComponentStorage.getExtensions<SingletonExtensionSelector>(ExtensionPoint).toList()
instanceField = when { instanceField = when {
instances.isEmpty() -> SingletonExtensionSelectorImpl instances.isEmpty() -> SingletonExtensionSelectorImpl
instances.size == 1 -> { instances.size == 1 -> {
@ -76,6 +76,7 @@ public interface SingletonExtensionSelector : FunctionExtension {
MiraiConsole.mainLogger.info { "Loaded SingletonExtensionSelector: ${registry.extension} from ${registry.plugin?.name ?: "<builtin>"}" } MiraiConsole.mainLogger.info { "Loaded SingletonExtensionSelector: ${registry.extension} from ${registry.plugin?.name ?: "<builtin>"}" }
}.extension }.extension
} }
else -> { else -> {
val hint = instances.joinToString { reg -> val hint = instances.joinToString { reg ->
"'${reg.extension}' from '${reg.plugin?.name ?: "<builtin>"}'" "'${reg.extension}' from '${reg.plugin?.name ?: "<builtin>"}'"

View File

@ -160,7 +160,7 @@ internal class MiraiConsoleImplementationBridge(
"MiraiLogger.Factory.create(yourClass::class, identity)", "MiraiLogger.Factory.create(yourClass::class, identity)",
"net.mamoe.mirai.utils.MiraiLogger" "net.mamoe.mirai.utils.MiraiLogger"
), ),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
override fun createLogger(identity: String?): MiraiLogger { override fun createLogger(identity: String?): MiraiLogger {
return MiraiLogger.Factory.create(MiraiConsole::class, identity) return MiraiLogger.Factory.create(MiraiConsole::class, identity)

View File

@ -26,9 +26,9 @@ import kotlin.reflect.KClass
@Deprecated( @Deprecated(
"Order of extensions is not determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ", "Order of extensions is not determined by its priority property since 2.11. SingletonExtensionSelector is not needed anymore. ",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
@DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13") @DeprecatedSinceMirai(warningSince = "2.11", errorSince = "2.13", hiddenSince = "2.14")
internal object SingletonExtensionSelectorImpl : SingletonExtensionSelector { internal object SingletonExtensionSelectorImpl : SingletonExtensionSelector {
internal val config: SaveData = SaveData() internal val config: SaveData = SaveData()

View File

@ -79,7 +79,7 @@ open class MockConsoleImplementation : MiraiConsoleImplementation {
@Suppress("DeprecatedCallableAddReplaceWith") @Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated( @Deprecated(
"Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.", "Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.",
level = DeprecationLevel.ERROR level = DeprecationLevel.HIDDEN
) )
override fun createLogger(identity: String?): MiraiLogger { override fun createLogger(identity: String?): MiraiLogger {
return PlatformLogger(identity) return PlatformLogger(identity)

View File

@ -1,6 +1,5 @@
public abstract class net/mamoe/mirai/console/frontendbase/AbstractMiraiConsoleFrontendImplementation : kotlinx/coroutines/CoroutineScope, net/mamoe/mirai/console/MiraiConsoleImplementation { public abstract class net/mamoe/mirai/console/frontendbase/AbstractMiraiConsoleFrontendImplementation : kotlinx/coroutines/CoroutineScope, net/mamoe/mirai/console/MiraiConsoleImplementation {
public fun <init> (Ljava/lang/String;)V public fun <init> (Ljava/lang/String;)V
public fun createLogger (Ljava/lang/String;)Lnet/mamoe/mirai/utils/MiraiLogger;
public fun createLoggerFactory (Lnet/mamoe/mirai/console/MiraiConsoleImplementation$FrontendLoggingInitContext;)Lnet/mamoe/mirai/utils/MiraiLogger$Factory; public fun createLoggerFactory (Lnet/mamoe/mirai/console/MiraiConsoleImplementation$FrontendLoggingInitContext;)Lnet/mamoe/mirai/utils/MiraiLogger$Factory;
public fun getBuiltInPluginLoaders ()Ljava/util/List; public fun getBuiltInPluginLoaders ()Ljava/util/List;
public fun getCommandManager ()Lnet/mamoe/mirai/console/command/CommandManager; public fun getCommandManager ()Lnet/mamoe/mirai/console/command/CommandManager;

View File

@ -75,18 +75,6 @@ public abstract class AbstractMiraiConsoleFrontendImplementation(
// region Logging // region Logging
@Deprecated(
"Deprecated for removal. Implement the other overload, or use MiraiConsole.createLogger instead.",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith(
"MiraiLogger.Factory.create(javaClass, identity)",
"net.mamoe.mirai.utils.MiraiLogger"
)
)
override fun createLogger(identity: String?): MiraiLogger {
return MiraiLogger.Factory.create(javaClass, identity)
}
override fun createLoggerFactory(context: MiraiConsoleImplementation.FrontendLoggingInitContext): MiraiLogger.Factory { override fun createLoggerFactory(context: MiraiConsoleImplementation.FrontendLoggingInitContext): MiraiLogger.Factory {
@Suppress("INVISIBLE_MEMBER") @Suppress("INVISIBLE_MEMBER")
frontendBase.initScreen_forwardStdToScreen() frontendBase.initScreen_forwardStdToScreen()

View File

@ -90,16 +90,6 @@ public interface IMirai : LowLevelApiAccessor {
*/ */
public var FileCacheStrategy: FileCacheStrategy public var FileCacheStrategy: FileCacheStrategy
// /**
// * Mirai 上传好友图片等使用的 Ktor [HttpClient].
// * 默认使用 [OkHttp] 引擎, 连接超时为 30s.
// *
// * 覆盖后将会立即应用到全局.
// */
// @Deprecated("Mirai is not going to use ktor. This is deprecated for removal.", level = DeprecationLevel.WARNING)
// @DeprecatedSinceMirai(warningSince = "2.11.0")
// public var Http: HttpClient
/** /**
* 获取 uin. * 获取 uin.
* *

View File

@ -20,6 +20,7 @@ import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge
import net.mamoe.mirai.Bot import net.mamoe.mirai.Bot
import net.mamoe.mirai.Mirai import net.mamoe.mirai.Mirai
import net.mamoe.mirai.contact.* import net.mamoe.mirai.contact.*
import net.mamoe.mirai.contact.announcement.Announcements
import net.mamoe.mirai.data.GroupHonorType import net.mamoe.mirai.data.GroupHonorType
import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.event.BroadcastControllable import net.mamoe.mirai.event.BroadcastControllable
@ -189,9 +190,13 @@ public data class GroupNameChangeEvent @MiraiInternalApi constructor(
/** /**
* 入群公告改变. 此事件广播前修改就已经完成. * 入群公告改变. 此事件广播前修改就已经完成.
*
* ## 已弃用
*
* 本事件不会再被触发. 无替代方法获知入群公告改变事件. 可使用 [Announcements] 主动获取所有公告列表.
*/ */
@DeprecatedSinceMirai(warningSince = "2.12") @DeprecatedSinceMirai(warningSince = "2.12", errorSince = "2.14")
@Deprecated("This event is not being triggered anymore.", level = DeprecationLevel.WARNING) @Deprecated("This event is not being triggered anymore.", level = DeprecationLevel.ERROR)
public data class GroupEntranceAnnouncementChangeEvent @MiraiInternalApi constructor( public data class GroupEntranceAnnouncementChangeEvent @MiraiInternalApi constructor(
public override val origin: String, public override val origin: String,
public override val new: String, public override val new: String,

View File

@ -374,18 +374,22 @@ public sealed interface MessageChain :
* @since 2.12 * @since 2.12
*/ */
// Java: MessageUtils.emptyMessageChain() // Java: MessageUtils.emptyMessageChain()
@Suppress("DEPRECATION") @Suppress("DEPRECATION", "DEPRECATION_ERROR")
public fun emptyMessageChain(): MessageChain = EmptyMessageChain public fun emptyMessageChain(): MessageChain = EmptyMessageChain
/** /**
* 不含任何元素的 [MessageChain]. 已弃用, 请使用 [emptyMessageChain] * 不含任何元素的 [MessageChain]. 已弃用, 请使用 [emptyMessageChain].
*/ */
//@Serializable(MessageChain.Serializer::class) //@Serializable(MessageChain.Serializer::class)
@Deprecated( @Deprecated(
"Please use emptyMessageChain()", "Please use emptyMessageChain()",
replaceWith = ReplaceWith("emptyMessageChain()", "net.mamoe.mirai.message.data.emptyMessageChain") replaceWith = ReplaceWith("emptyMessageChain()", "net.mamoe.mirai.message.data.emptyMessageChain"),
level = DeprecationLevel.ERROR
) )
@DeprecatedSinceMirai(warningSince = "2.12") @DeprecatedSinceMirai(
warningSince = "2.12",
errorSince = "2.14"
) // make internal after deprecation cycle, but keep as @PublishedApi!
@Suppress("EXPOSED_SUPER_CLASS") @Suppress("EXPOSED_SUPER_CLASS")
public object EmptyMessageChain : MessageChain, List<SingleMessage> by emptyList(), public object EmptyMessageChain : MessageChain, List<SingleMessage> by emptyList(),
AbstractMessageChain(), DirectSizeAccess, DirectToStringAccess { AbstractMessageChain(), DirectSizeAccess, DirectToStringAccess {

View File

@ -82,32 +82,6 @@ public actual abstract class EventChannel<out BaseEvent : Event> @MiraiInternalA
*/ */
public actual val defaultCoroutineContext: CoroutineContext, public actual val defaultCoroutineContext: CoroutineContext,
) { ) {
/**
* 创建事件监听并将监听结果发送在 [Channel]. 将返回值 [Channel] [关闭][Channel.close] 时将会同时关闭事件监听.
*
* @param capacity Channel 容量. 详见 [Channel] 构造.
*
* @see subscribeAlways
* @see Channel
*/
@Deprecated(
"Please use forwardToChannel instead.",
replaceWith = ReplaceWith(
"Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }",
"kotlinx.coroutines.channels.Channel"
),
level = DeprecationLevel.WARNING,
)
@DeprecatedSinceMirai(warningSince = "2.10")
@MiraiExperimentalApi
public fun asChannel(
capacity: Int = Channel.RENDEZVOUS,
coroutineContext: CoroutineContext = EmptyCoroutineContext,
@Suppress("UNUSED_PARAMETER") concurrency: ConcurrencyKind = CONCURRENT,
priority: EventPriority = EventPriority.NORMAL,
): Channel<out BaseEvent> =
Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }
/** /**
* 创建事件监听并将监听结果转发到 [channel]. [Channel.send] 抛出 [ClosedSendChannelException] 时停止 [Listener] 监听和转发. * 创建事件监听并将监听结果转发到 [channel]. [Channel.send] 抛出 [ClosedSendChannelException] 时停止 [Listener] 监听和转发.
* *
@ -684,6 +658,40 @@ public actual abstract class EventChannel<out BaseEvent : Event> @MiraiInternalA
// endregion // endregion
// region deprecated
/**
* 创建事件监听并将监听结果发送在 [Channel]. 将返回值 [Channel] [关闭][Channel.close] 时将会同时关闭事件监听.
*
* ## 已弃用
*
* 请使用 [forwardToChannel] 替代.
*
* @param capacity Channel 容量. 详见 [Channel] 构造.
*
* @see subscribeAlways
* @see Channel
*/
@Deprecated(
"Please use forwardToChannel instead.",
replaceWith = ReplaceWith(
"Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }",
"kotlinx.coroutines.channels.Channel"
),
level = DeprecationLevel.ERROR,
)
@DeprecatedSinceMirai(warningSince = "2.10", errorSince = "2.14")
@MiraiExperimentalApi
public fun asChannel(
capacity: Int = Channel.RENDEZVOUS,
coroutineContext: CoroutineContext = EmptyCoroutineContext,
@Suppress("UNUSED_PARAMETER") concurrency: ConcurrencyKind = CONCURRENT,
priority: EventPriority = EventPriority.NORMAL,
): Channel<out BaseEvent> =
Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }
// endregion
// region impl // region impl

View File

@ -203,8 +203,8 @@ public inline fun <reified E : Event, R : Any> CoroutineScope.asyncFromEvent(
//// internal //// internal
////////////// //////////////
@Deprecated("Deprecated since its usages are deprecated") @Deprecated("Deprecated since its usages are deprecated", level = DeprecationLevel.HIDDEN)
@DeprecatedSinceMirai(warningSince = "2.10") @DeprecatedSinceMirai(warningSince = "2.10", hiddenSince = "2.14")
@JvmSynthetic @JvmSynthetic
@PublishedApi @PublishedApi
internal suspend inline fun <E : Event, R> syncFromEventImpl( internal suspend inline fun <E : Event, R> syncFromEventImpl(

View File

@ -35,14 +35,14 @@ internal class GroupSettingsImpl(
getter: () -> T, getter: () -> T,
setter: (T) -> Unit, setter: (T) -> Unit,
crossinline packetConstructor: (client: QQAndroidClient, groupCode: Long, newValue: T) -> OutgoingPacket, crossinline packetConstructor: (client: QQAndroidClient, groupCode: Long, newValue: T) -> OutgoingPacket,
crossinline eventConstructor: (old: T) -> Event, crossinline eventConstructor: (old: T) -> Event?,
) { ) {
checkBotPermission(MemberPermission.ADMINISTRATOR) checkBotPermission(MemberPermission.ADMINISTRATOR)
val oldValue = getter() val oldValue = getter()
setter(newValue) setter(newValue)
launch { launch {
bot.network.sendWithoutExpect(packetConstructor(bot.client, id, newValue)) bot.network.sendWithoutExpect(packetConstructor(bot.client, id, newValue))
eventConstructor(oldValue).broadcast() eventConstructor(oldValue)?.broadcast()
} }
} }
@ -64,8 +64,7 @@ internal class GroupSettingsImpl(
get() = _entranceAnnouncement get() = _entranceAnnouncement
set(newValue) { set(newValue) {
group.setImpl(newValue, { _entranceAnnouncement }, { _entranceAnnouncement = it }, GroupOperation::memo) { group.setImpl(newValue, { _entranceAnnouncement }, { _entranceAnnouncement = it }, GroupOperation::memo) {
@Suppress("DEPRECATION") null
net.mamoe.mirai.event.events.GroupEntranceAnnouncementChangeEvent(it, newValue, group, null)
} }
} }