Merely an alias to immediate, because we use both terms at different places.
Sends a channel message.
Sends an ACTION "emote" to the supplied target (nickname or channel).
Sends raw text to the server, verbatim, bypassing all queues and throttling delays.
Invites a user to a channel.
Joins a channel.
Kicks a user from a channel.
Sets a channel mode.
Leaves a channel.
Sends either a channel message or a private query message depending on the arguments passed to it.
Sends a private query message to a user.
Disconnects from the server, optionally with a quit reason.
Sends text to the server, verbatim.
Replies to a channel message.
Sets the topic of a channel.
Queries the server for WHOIS information about a user.
Flag denoting that MessagingProxy has been mixed in.
Whether or not to include debugging output.
1 import kameloso.plugins.common : IRCPlugin, IRCPluginImpl, IRCPluginState; 2 3 class MyPlugin : IRCPlugin 4 { 5 mixin MessagingProxy; 6 mixin IRCPluginImpl; 7 } 8 9 IRCPluginState state; 10 MyPlugin plugin = new MyPlugin(state); 11 12 with (plugin) 13 { 14 // The below calls will fail in-contracts, so don't call them. 15 // Just generate the code so we know they compile. 16 if (plugin !is null) return; 17 18 /*chan(string.init, string.init); 19 query(string.init, string.init); 20 privmsg(string.init, string.init, string.init); 21 emote(string.init, string.init); 22 mode(string.init, string.init, string.init); 23 topic(string.init, string.init); 24 invite(string.init, string.init); 25 join(string.init, string.init); 26 kick(string.init, string.init, string.init); 27 part(string.init, string.init); 28 quit(string.init); 29 enum whoisProperties = (Message.Property.forced | Message.Property.quiet); 30 whois(string.init, whoisProperties); 31 raw(string.init); 32 immediate(string.init); 33 immediateline(string.init);*/ 34 askToWriteln(string.init); 35 askToTrace(string.init); 36 askToLog(string.init); 37 askToInfo(string.init); 38 askToWarn(string.init); 39 askToWarning(string.init); 40 askToError(string.init); 41 } 42 43 class MyPlugin2 : IRCPlugin 44 { 45 mixin MessagingProxy fromMixin; 46 mixin IRCPluginImpl; 47 } 48 49 static if (__VERSION__ >= 2097L) 50 { 51 static import kameloso.messaging; 52 53 MyPlugin2 plugin2 = new MyPlugin2(state); 54 55 foreach (immutable funstring; __traits(derivedMembers, kameloso.messaging)) 56 { 57 import std.algorithm.comparison : among; 58 import std.algorithm.searching : startsWith; 59 60 static if (funstring.among!( 61 "object", 62 "dialect", 63 "kameloso", 64 "Message") || 65 funstring.startsWith("ask")) 66 { 67 //pragma(msg, "ignoring " ~ funstring); 68 } 69 else static if (!__traits(compiles, { mixin("alias _ = plugin2.fromMixin." ~ funstring ~ ";"); })) 70 { 71 import std.format : format; 72 73 enum pattern = "`MessagingProxy` is missing a wrapper for `kameloso.messaging.%s`"; 74 enum message = pattern.format(funstring); 75 static assert(0, message); 76 } 77 } 78 }
Mixin to give shorthands to the functions in kameloso.messaging, for easier use when in a with (plugin) { /* ... */ } scope.
This merely makes it possible to use commands like raw("PING :irc.freenode.net") without having to import kameloso.messaging and include the thread ID of the main thread in every call of the functions.