zorael / kameloso

IRC bot with Twitch support
Boost Software License 1.0
9 stars 3 forks source link

next, toward 3.0 #114

Closed zorael closed 2 years ago

zorael commented 2 years ago

This migrates all plugins from using separate UDAs when annotating an event handler, each having a separate function, to just using one.

Before:

@Verbose
@Chainable
@(IRCEvent.Type.CHAN)
@(IRCEvent.Type.QUERY)
@(PermissionsRequired.anyone)
@(ChannelPolicy.home)
@BotCommand(PrefixPolicy.prefixed, "hello")
@Description("Says hello.")
void onCommandHello(HelloPlugin plugin, const ref IRCEvent event)
{
    // ...
}

After:

@(IRCEventHandler()
    .onEvent(IRCEvent.Type.CHAN)
    .onEvent(IRCEvent.Type.QUERY)
    .requiredPermissions(Permissions.anyone)
    .channelPolicy(ChannelPolicy.home)
    .chainable(true)
    .verbose(true)
    .addCommand(
        IRCEventHandler.Command()
            .word("hello")
            .policy(PrefixPolicy.prefixed)
            .description("Says hello.")
    )
)
void onCommandHello(HelloPlugin plugin, const ref IRCEvent event)
{
    // ...
}

Memory needed to compile dropped some ~100 Mb with this change, but it quickly grew back to its previous levels.

There are more changes in this merge; mere renames, optimisations, refactors. The migration to the new UDA scheme is the biggest of them, however.

Currently ldc does not compile on Windows anymore, which is troubling. I'll look into doing a dustmite run later.