Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 1.02 KB

DiscordSubscriptions.md

File metadata and controls

37 lines (24 loc) · 1.02 KB

Discord Subscriptions

Allows plugins to register callbacks when a message is created in a specified channel. This supports guild channels, guild categories, and direct messages. When a plugin that has registered subscriptions is unloaded then the subscriptions will be removed.

Getting Started

To be able to register channels for subscriptions you need to add the following line to your plugin.

private readonly DiscordSubscriptions _subscriptions = Interface.Oxide.GetLibrary<DiscordSubscriptions>();

Registering Subscription

To register a subscription you can use the following example below

_subscriptions.AddChannelSubscription(this, snowflakeChannelId, CallbackMethod);

Unregistering Subscription

To unregister a subscription you can use the following example below

_subscriptions.RemoveChannelSubscription(this, snowflakeChannelId, CallbackMethod);

Callback

The callback for a subscription will be the DiscordMessage object.

void CallbackMethod(DiscordMessage message)