Skip to content

Commit

Permalink
Merge pull request #1 from YumeChan-DT/develop
Browse files Browse the repository at this point in the history
1.0 - Release
  • Loading branch information
DJ Daemonix authored Nov 20, 2019
2 parents 1e9ac70 + 242f0ed commit 6c6dc2b
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "YumeChan PluginBase"]
path = Nodsoft.YumeChan.PluginBase
url = https://github.com/YumeChan-DT/YumeChan-PluginBase
1 change: 1 addition & 0 deletions Nodsoft.YumeChan.PluginBase
31 changes: 31 additions & 0 deletions Nodsoft.YumeChan.PluginSample-VB.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29505.145
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Nodsoft.YumeChan.PluginSample-VB", "Nodsoft.YumeChan.PluginSample-VB\Nodsoft.YumeChan.PluginSample-VB.vbproj", "{E47E77E8-D586-461D-B16D-1B26C2AC1F41}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nodsoft.YumeChan.PluginBase", "Nodsoft.YumeChan.PluginBase\Nodsoft.YumeChan.PluginBase.csproj", "{BF0352BC-CDD6-4CCE-899D-5A0D42390782}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E47E77E8-D586-461D-B16D-1B26C2AC1F41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E47E77E8-D586-461D-B16D-1B26C2AC1F41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E47E77E8-D586-461D-B16D-1B26C2AC1F41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E47E77E8-D586-461D-B16D-1B26C2AC1F41}.Release|Any CPU.Build.0 = Release|Any CPU
{BF0352BC-CDD6-4CCE-899D-5A0D42390782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF0352BC-CDD6-4CCE-899D-5A0D42390782}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF0352BC-CDD6-4CCE-899D-5A0D42390782}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF0352BC-CDD6-4CCE-899D-5A0D42390782}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {18A0E7B0-F7A3-4679-A166-F9689CF85B67}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Nodsoft.YumeChan.PluginSample_VB</RootNamespace>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.0.0</Version>
<Authors>DJ Daemonix</Authors>
<Company>YumeChan-DT</Company>
<Product>YumeChan : PluginSampleVB</Product>
<Copyright>MIT License</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/YumeChan-DT/SamplePlugin-VB</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Discord.Net.Commands" Version="2.1.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Nodsoft.YumeChan.PluginBase\Nodsoft.YumeChan.PluginBase.csproj" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions Nodsoft.YumeChan.PluginSample-VB/PingModule.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Imports Discord.Commands


' Classes can here act as a bundle of Commands. The only limitation is one Class per Group Name.
'
' A few Rules :
' - Class MUST inherit ModuleBase to get flagged as a Module containing commands.
' - Class MUST be set as public to get picked up by the Loader.
'
' /!\ DO NOT USE THESE CLASSES TO STORE PERSISTENT DATA. /!\
' Each "Command Group" Class is Instantiated when a Command from its group is called.
' The instance immediately vanishes after finishing command execution.
<Group("ping")>
Public Class PingModule
Inherits ModuleBase(Of SocketCommandContext)

<Command("visualbasic"), [Alias]("vb")>
Public Async Function PingHelloVisualBasicCommandAsync() As Task
Await ReplyAsync("Hello from YumeChan's Visual Basic Sample Plugin !")
End Function

End Class
55 changes: 55 additions & 0 deletions Nodsoft.YumeChan.PluginSample-VB/PluginManifest.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Imports Nodsoft.YumeChan.PluginBase


' This Class defines the Plugin, and makes it visible to the Loader.
Public Class PluginManifest ' Class MUST be set as Public to get picked up by the Loader.
Implements IPlugin

' For Good principle, do not change a thing here, unless your Versionning has to be different from that of the Assembly.
' Consider changing your Version within the Assembly instead.
Public ReadOnly Property PluginVersion As Version Implements IPlugin.PluginVersion
Get
Return [GetType].Assembly.GetName.Version
End Get
End Property

Public ReadOnly Property PluginDisplayName As String Implements IPlugin.PluginDisplayName
Get
Return "YumeChan : Sample Plugin"
End Get
End Property

Public ReadOnly Property PluginStealth As Boolean Implements IPlugin.PluginStealth
Get
Return False
End Get
End Property

' This is handled solely by the LoadPlugin() and UnloadPlugin() Functions below.
Public Property PluginLoaded As Boolean Implements IPlugin.PluginLoaded
Get
Return _PluginLoaded
End Get
Private Set
_PluginLoaded = Value
End Set
End Property
Private _PluginLoaded As Boolean

Public Function LoadPlugin() As Task Implements IPlugin.LoadPlugin
' Here goes the Loading Logic, if some loading procedure is needed. Treat it as a Ctor.

PluginLoaded = True
Return Task.CompletedTask
End Function

Public Function UnloadPlugin() As Task Implements IPlugin.UnloadPlugin
' Here goes the Unloading Logic, if some unloading (e.g: Disposal) is needed. Treat it as a Dtor.

PluginLoaded = False
Return Task.CompletedTask
End Function
End Class

' For more info, check Discord.NET's guide on Commands : https://discord.foxbot.me/docs/guides/commands/intro.html#modules
' A good knowledge of C# and CLR Aspects will be necessary, to translate Examples from C# to VB.

0 comments on commit 6c6dc2b

Please sign in to comment.