Skyfly

Member
Skyfly submitted a new resource:

UODisc - a discord bot - A discord bot based on DSharpPlus

UODisc - a Discord Bot based on DSharpPlus

With this tool you can communicate and act between discord and the server.

I developed this with the intention of making it easy to implement a discord bot with features while leaving as much as possible open to the user, currently the bot does not have much commands or big features as this is a first WIP release but that will change later on.

Some things I plan to include are:
Sending and receiving pm's if the server supports it
Managing online...

Read more about this resource...
 
Oh man if you can get this to do global chat that would be so amazing thank you for this resource!
 
Love the stuff.
Notice I must re-linkaccount every time I restart the server
Something I missed or its default??
It should be saved when the world is saved

What messages does the client write to the console? (they're all prefixed with "Discord: ")
 
What messages does the client write to the console? (they're all prefixed with "Discord: ")

df2cae70384f2ca106df11e9b7a4a97c.png


2e5720e4dd6ce04f52bc379cd0207390.png

between the timeline i did a server restart * shutdown * in console just to be sure it did save
and now i start up the server and i get that i dont have permission to use it

edit forgot to add

this is my discord.cfg


Token=NzYzMDA5NTA2MjUwMDYzOTAy.X3xd-g.Mj7H9diHNklvfRlHD453fZDJ_a0

GuildId=286902589822337026

CommandPrefix=$

CommandChannelId=762250722347450398

LogChannelId=762250722347450398

DONT worry
its a test empty discord server i use it on to make sure its working before i do anything else
will rechange/make it all in the discord.cfg including the Bot itself :p
 
What messages does the client write to the console? (they're all prefixed with "Discord: ")

df2cae70384f2ca106df11e9b7a4a97c.png


2e5720e4dd6ce04f52bc379cd0207390.png

between the timeline i did a server restart * shutdown * in console just to be sure it did save
and now i start up the server and i get that i dont have permission to use it

edit forgot to add

this is my discord.cfg


Token=

GuildId=286902589822337026

CommandPrefix=$

CommandChannelId=762250722347450398

LogChannelId=762250722347450398

DONT worry
its a test empty discord server i use it on to make sure its working before i do anything else
will rechange/make it all in the discord.cfg including the Bot itself :p
Never share your discord token in public! (if discord didn't revoke the token by themselves automatically already you should generate a new one by yourself as soon as possible!)

For some reason i used the wrong integer for the for-loop which gets the users accounts, fixed it in the source (will do a release at a later time)

For now just go into UODisc/DiscordUserLink.cs and change the following line (line 141):
C#:
for (int i = 0; i < accs.Count; i++)
To:
C#:
for (int i = 0; i < length; i++)
 
The discord token I'm aware not to share but this isn't just a test bot and it can't do any harm because it sits on a empty discord with me only and other bots xD

Okay will test it tomorrow after work :)
 
Did you recompile? it worked out when i tested it
if you recompiled and it still doesn't work, delete the Saves/Discord/Client.bin and try again
 
Strange
i did remove the client.bin restart ( recompile ) and start up and linkaccount did saveworld on discord and console
closed it reopen and didnt save :s
 
Al momento non ho intenzione di supportare versioni precedenti di servuo,
l'errore sopra si verifica poiché le versioni precedenti di servuo non utilizzano le nuove funzionalità del linguagg

I don't have any plans to currently support older servuo versions,
the error above comes since the older versions of servuo don't use the new language features
i am using the latest version of servuo pub57
Post automatically merged:

No the error comes because mono does not support the default literals
could you tell me how i could solve the problem?
 
Are you using the newest servuo version? cause it really looks to me like you're using an older servuo version
i use latest version of servuo (57)


Code:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="[URL]http://schemas.microsoft.com/developer/msbuild/2003[/URL]" ToolsVersion="12.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Server</RootNamespace>
    <AssemblyName>ServUO</AssemblyName>
    <ApplicationIcon>servuo.ico</ApplicationIcon>
    <StartupObject>Server.Core</StartupObject>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\</OutputPath>
    <DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <Prefer32Bit>false</Prefer32Bit>
    <DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
  </PropertyGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
  <ItemGroup>
    <Compile Include=".\AggressorInfo.cs" />
    <Compile Include=".\AssemblyInfo.cs" />
    <Compile Include=".\Attributes.cs" />
    <Compile Include=".\BaseVendor.cs" />
    <Compile Include=".\Body.cs" />
    <Compile Include=".\ClientVersion.cs" />
    <Compile Include=".\Commands.cs" />
    <Compile Include=".\ContextMenus\ContextMenu.cs" />
    <Compile Include=".\ContextMenus\ContextMenuEntry.cs" />
    <Compile Include=".\ContextMenus\OpenBackpackEntry.cs" />
    <Compile Include=".\ContextMenus\PaperdollEntry.cs" />
    <Compile Include=".\Customs Framework\Central Core\Base Types\BaseCore.cs" />
    <Compile Include=".\Customs Framework\Central Core\Base Types\BaseModule.cs" />
    <Compile Include=".\Customs Framework\Central Core\Base Types\BaseService.cs" />
    <Compile Include=".\Customs Framework\Central Core\Base Types\Events.cs" />
    <Compile Include=".\Customs Framework\Central Core\Base Types\SaveData.cs" />
    <Compile Include=".\Customs Framework\Central Core\CustomSerial.cs" />
    <Compile Include=".\Customs Framework\Central Core\Interfaces.cs" />
    <Compile Include=".\Customs Framework\Custom Types\LastEditedBy.cs" />
    <Compile Include=".\Customs Framework\Custom Types\Place.cs" />
    <Compile Include=".\Customs Framework\Utilities\Decompressor.cs" />
    <Compile Include=".\Customs Framework\Utilities\ObjectDumper.cs" />
    <Compile Include=".\Customs Framework\Utilities\OutgoingPacketOverride.cs" />
    <Compile Include=".\Customs Framework\Utilities\Utilities.cs" />
    <Compile Include=".\Diagnostics\BaseProfile.cs" />
    <Compile Include=".\Diagnostics\GumpProfile.cs" />
    <Compile Include=".\Diagnostics\PacketProfile.cs" />
    <Compile Include=".\Diagnostics\TargetProfile.cs" />
    <Compile Include=".\Diagnostics\TimerProfile.cs" />
    <Compile Include=".\Effects.cs" />
    <Compile Include=".\EventLog.cs" />
    <Compile Include=".\EventSink.cs" />
    <Compile Include=".\ExpansionInfo.cs" />
    <Compile Include=".\Geometry.cs" />
    <Compile Include=".\Guild.cs" />
    <Compile Include=".\HuePicker.cs" />
    <Compile Include=".\IAccount.cs" />
    <Compile Include=".\IEntity.cs" />
    <Compile Include=".\Insensitive.cs" />
    <Compile Include=".\Interfaces.cs" />
    <Compile Include=".\Item.cs" />
    <Compile Include=".\ItemBounds.cs" />
    <Compile Include=".\Items\BaseMulti.cs" />
    <Compile Include=".\Items\Container.cs" />
    <Compile Include=".\Items\Containers.cs" />
    <Compile Include=".\Items\SecureTradeContainer.cs" />
    <Compile Include=".\Items\VirtualHair.cs" />
    <Compile Include=".\KeywordList.cs" />
    <Compile Include=".\Main.cs" />
    <Compile Include=".\Map.cs" />
    <Compile Include=".\Menus\IMenu.cs" />
    <Compile Include=".\Menus\ItemListMenu.cs" />
    <Compile Include=".\Menus\QuestionMenu.cs" />
    <Compile Include=".\Mobile.cs" />
    <Compile Include=".\Movement.cs" />
    <Compile Include=".\MultiData.cs" />
    <Compile Include=".\NativeReader.cs" />
    <Compile Include=".\Network\BufferPool.cs" />
    <Compile Include=".\Network\ByteQueue.cs" />
    <Compile Include=".\Network\Compression.cs" />
    <Compile Include=".\Network\EncodedPacketHandler.cs" />
    <Compile Include=".\Network\EncodedReader.cs" />
    <Compile Include=".\Network\Listener.cs" />
    <Compile Include=".\Network\MessagePump.cs" />
    <Compile Include=".\Network\NetState.cs" />
    <Compile Include=".\Network\PacketHandler.cs" />
    <Compile Include=".\Network\PacketHandlers.cs" />
    <Compile Include=".\Network\PacketReader.cs" />
    <Compile Include=".\Network\Packets.cs" />
    <Compile Include=".\Network\PacketWriter.cs" />
    <Compile Include=".\Network\SendQueue.cs" />
    <Compile Include=".\Notoriety.cs" />
    <Compile Include=".\ObjectPropertyList.cs" />
    <Compile Include=".\Party.cs" />
    <Compile Include=".\Persistence\BinaryMemoryWriter.cs" />
    <Compile Include=".\Persistence\DualSaveStrategy.cs" />
    <Compile Include=".\Persistence\DynamicSaveStrategy.cs" />
    <Compile Include=".\Persistence\FileOperations.cs" />
    <Compile Include=".\Persistence\FileQueue.cs" />
    <Compile Include=".\Persistence\ParallelSaveStrategy.cs" />
    <Compile Include=".\Persistence\QueuedMemoryWriter.cs" />
    <Compile Include=".\Persistence\SaveMetrics.cs" />
    <Compile Include=".\Persistence\SaveStrategy.cs" />
    <Compile Include=".\Persistence\SequentialFileWriter.cs" />
    <Compile Include=".\Persistence\StandardSaveStrategy.cs" />
    <Compile Include=".\Point3DList.cs" />
    <Compile Include=".\Poison.cs" />
    <Compile Include=".\Prompt.cs" />
    <Compile Include=".\QuestArrow.cs" />
    <Compile Include=".\Race.cs" />
    <Compile Include=".\Region.cs" />
    <Compile Include=".\ScriptCompiler.cs" />
    <Compile Include=".\Sector.cs" />
    <Compile Include=".\SecureTrade.cs" />
    <Compile Include=".\Serial.cs" />
    <Compile Include=".\Serialization.cs" />
    <Compile Include=".\Skills.cs" />
    <Compile Include=".\Targeting\LandTarget.cs" />
    <Compile Include=".\Targeting\MultiTarget.cs" />
    <Compile Include=".\Targeting\StaticTarget.cs" />
    <Compile Include=".\Targeting\Target.cs" />
    <Compile Include=".\Targeting\TargetCancelType.cs" />
    <Compile Include=".\Targeting\TargetFlags.cs" />
    <Compile Include=".\TileData.cs" />
    <Compile Include=".\TileList.cs" />
    <Compile Include=".\TileMatrix.cs" />
    <Compile Include=".\TileMatrixPatch.cs" />
    <Compile Include=".\Timer.cs" />
    <Compile Include=".\Utility.cs" />
    <Compile Include=".\VirtueInfo.cs" />
    <Compile Include=".\World.cs" />
    <Compile Include="Config.cs" />
    <Compile Include="Gumps\ECHandleInput.cs" />
    <Compile Include="Gumps\Gump.cs" />
    <Compile Include="Gumps\GumpAlphaRegion.cs" />
    <Compile Include="Gumps\GumpBackground.cs" />
    <Compile Include="Gumps\GumpButton.cs" />
    <Compile Include="Gumps\GumpCheck.cs" />
    <Compile Include="Gumps\GumpEntry.cs" />
    <Compile Include="Gumps\GumpGroup.cs" />
    <Compile Include="Gumps\GumpHtml.cs" />
    <Compile Include="Gumps\GumpHtmlLocalized.cs" />
    <Compile Include="Gumps\GumpImage.cs" />
    <Compile Include="Gumps\GumpImageTileButton.cs" />
    <Compile Include="Gumps\GumpImageTiled.cs" />
    <Compile Include="Gumps\GumpItem.cs" />
    <Compile Include="Gumps\GumpItemProperty.cs" />
    <Compile Include="Gumps\GumpLabel.cs" />
    <Compile Include="Gumps\GumpLabelCropped.cs" />
    <Compile Include="Gumps\GumpPage.cs" />
    <Compile Include="Gumps\GumpRadio.cs" />
    <Compile Include="Gumps\GumpSpriteImage.cs" />
    <Compile Include="Gumps\GumpTextEntry.cs" />
    <Compile Include="Gumps\GumpTextEntryLimited.cs" />
    <Compile Include="Gumps\GumpTooltip.cs" />
    <Compile Include="Gumps\RelayInfo.cs" />
    <Compile Include="Network\PingListener.cs" />
    <Compile Include="Persistence\Persistence.cs" />
    <Compile Include="PromptExtensions.cs" />
    <Compile Include="Random.cs" />
    <Compile Include="Items\VirtualCheck.cs" />
    <Compile Include="SpawnArea.cs" />
  </ItemGroup>
   <ItemGroup>
<PackageReference Include="DSharpPlus" Version="3.2.3" />
<PackageReference Include="DSharpPlus.WebSocket.WebSocket4Net" Version="3.2.3" />
<PackageReference Include="DSharpPlus.WebSocket.WebSocketSharp" Version="3.2.3" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="servuo.ico" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Ultima\Ultima.csproj">
      <Project>{e08cfbe4-e013-44ee-8829-426d05bc083f}</Project>
      <Name>Ultima</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <None Include="ServUO.exe.manifest" />
  </ItemGroup>
  <Import Project="..\VersionSpecificSymbols.Common.prop" />
</Project>
 
i use latest version of servuo (57)



<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Server</RootNamespace>
<AssemblyName>ServUO</AssemblyName>
<ApplicationIcon>servuo.ico</ApplicationIcon>
<StartupObject>Server.Core</StartupObject>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>false</UseVSHostingProcess>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include=".\AggressorInfo.cs" />
<Compile Include=".\AssemblyInfo.cs" />
<Compile Include=".\Attributes.cs" />
<Compile Include=".\BaseVendor.cs" />
<Compile Include=".\Body.cs" />
<Compile Include=".\ClientVersion.cs" />
<Compile Include=".\Commands.cs" />
<Compile Include=".\ContextMenus\ContextMenu.cs" />
<Compile Include=".\ContextMenus\ContextMenuEntry.cs" />
<Compile Include=".\ContextMenus\OpenBackpackEntry.cs" />
<Compile Include=".\ContextMenus\PaperdollEntry.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseCore.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseModule.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseService.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\Events.cs" />
<Compile Include=".\Customs Framework\Central Core\Base Types\SaveData.cs" />
<Compile Include=".\Customs Framework\Central Core\CustomSerial.cs" />
<Compile Include=".\Customs Framework\Central Core\Interfaces.cs" />
<Compile Include=".\Customs Framework\Custom Types\LastEditedBy.cs" />
<Compile Include=".\Customs Framework\Custom Types\Place.cs" />
<Compile Include=".\Customs Framework\Utilities\Decompressor.cs" />
<Compile Include=".\Customs Framework\Utilities\ObjectDumper.cs" />
<Compile Include=".\Customs Framework\Utilities\OutgoingPacketOverride.cs" />
<Compile Include=".\Customs Framework\Utilities\Utilities.cs" />
<Compile Include=".\Diagnostics\BaseProfile.cs" />
<Compile Include=".\Diagnostics\GumpProfile.cs" />
<Compile Include=".\Diagnostics\PacketProfile.cs" />
<Compile Include=".\Diagnostics\TargetProfile.cs" />
<Compile Include=".\Diagnostics\TimerProfile.cs" />
<Compile Include=".\Effects.cs" />
<Compile Include=".\EventLog.cs" />
<Compile Include=".\EventSink.cs" />
<Compile Include=".\ExpansionInfo.cs" />
<Compile Include=".\Geometry.cs" />
<Compile Include=".\Guild.cs" />
<Compile Include=".\HuePicker.cs" />
<Compile Include=".\IAccount.cs" />
<Compile Include=".\IEntity.cs" />
<Compile Include=".\Insensitive.cs" />
<Compile Include=".\Interfaces.cs" />
<Compile Include=".\Item.cs" />
<Compile Include=".\ItemBounds.cs" />
<Compile Include=".\Items\BaseMulti.cs" />
<Compile Include=".\Items\Container.cs" />
<Compile Include=".\Items\Containers.cs" />
<Compile Include=".\Items\SecureTradeContainer.cs" />
<Compile Include=".\Items\VirtualHair.cs" />
<Compile Include=".\KeywordList.cs" />
<Compile Include=".\Main.cs" />
<Compile Include=".\Map.cs" />
<Compile Include=".\Menus\IMenu.cs" />
<Compile Include=".\Menus\ItemListMenu.cs" />
<Compile Include=".\Menus\QuestionMenu.cs" />
<Compile Include=".\Mobile.cs" />
<Compile Include=".\Movement.cs" />
<Compile Include=".\MultiData.cs" />
<Compile Include=".\NativeReader.cs" />
<Compile Include=".\Network\BufferPool.cs" />
<Compile Include=".\Network\ByteQueue.cs" />
<Compile Include=".\Network\Compression.cs" />
<Compile Include=".\Network\EncodedPacketHandler.cs" />
<Compile Include=".\Network\EncodedReader.cs" />
<Compile Include=".\Network\Listener.cs" />
<Compile Include=".\Network\MessagePump.cs" />
<Compile Include=".\Network\NetState.cs" />
<Compile Include=".\Network\PacketHandler.cs" />
<Compile Include=".\Network\PacketHandlers.cs" />
<Compile Include=".\Network\PacketReader.cs" />
<Compile Include=".\Network\Packets.cs" />
<Compile Include=".\Network\PacketWriter.cs" />
<Compile Include=".\Network\SendQueue.cs" />
<Compile Include=".\Notoriety.cs" />
<Compile Include=".\ObjectPropertyList.cs" />
<Compile Include=".\Party.cs" />
<Compile Include=".\Persistence\BinaryMemoryWriter.cs" />
<Compile Include=".\Persistence\DualSaveStrategy.cs" />
<Compile Include=".\Persistence\DynamicSaveStrategy.cs" />
<Compile Include=".\Persistence\FileOperations.cs" />
<Compile Include=".\Persistence\FileQueue.cs" />
<Compile Include=".\Persistence\ParallelSaveStrategy.cs" />
<Compile Include=".\Persistence\QueuedMemoryWriter.cs" />
<Compile Include=".\Persistence\SaveMetrics.cs" />
<Compile Include=".\Persistence\SaveStrategy.cs" />
<Compile Include=".\Persistence\SequentialFileWriter.cs" />
<Compile Include=".\Persistence\StandardSaveStrategy.cs" />
<Compile Include=".\Point3DList.cs" />
<Compile Include=".\Poison.cs" />
<Compile Include=".\Prompt.cs" />
<Compile Include=".\QuestArrow.cs" />
<Compile Include=".\Race.cs" />
<Compile Include=".\Region.cs" />
<Compile Include=".\ScriptCompiler.cs" />
<Compile Include=".\Sector.cs" />
<Compile Include=".\SecureTrade.cs" />
<Compile Include=".\Serial.cs" />
<Compile Include=".\Serialization.cs" />
<Compile Include=".\Skills.cs" />
<Compile Include=".\Targeting\LandTarget.cs" />
<Compile Include=".\Targeting\MultiTarget.cs" />
<Compile Include=".\Targeting\StaticTarget.cs" />
<Compile Include=".\Targeting\Target.cs" />
<Compile Include=".\Targeting\TargetCancelType.cs" />
<Compile Include=".\Targeting\TargetFlags.cs" />
<Compile Include=".\TileData.cs" />
<Compile Include=".\TileList.cs" />
<Compile Include=".\TileMatrix.cs" />
<Compile Include=".\TileMatrixPatch.cs" />
<Compile Include=".\Timer.cs" />
<Compile Include=".\Utility.cs" />
<Compile Include=".\VirtueInfo.cs" />
<Compile Include=".\World.cs" />
<Compile Include="Config.cs" />
<Compile Include="Gumps\ECHandleInput.cs" />
<Compile Include="Gumps\Gump.cs" />
<Compile Include="Gumps\GumpAlphaRegion.cs" />
<Compile Include="Gumps\GumpBackground.cs" />
<Compile Include="Gumps\GumpButton.cs" />
<Compile Include="Gumps\GumpCheck.cs" />
<Compile Include="Gumps\GumpEntry.cs" />
<Compile Include="Gumps\GumpGroup.cs" />
<Compile Include="Gumps\GumpHtml.cs" />
<Compile Include="Gumps\GumpHtmlLocalized.cs" />
<Compile Include="Gumps\GumpImage.cs" />
<Compile Include="Gumps\GumpImageTileButton.cs" />
<Compile Include="Gumps\GumpImageTiled.cs" />
<Compile Include="Gumps\GumpItem.cs" />
<Compile Include="Gumps\GumpItemProperty.cs" />
<Compile Include="Gumps\GumpLabel.cs" />
<Compile Include="Gumps\GumpLabelCropped.cs" />
<Compile Include="Gumps\GumpPage.cs" />
<Compile Include="Gumps\GumpRadio.cs" />
<Compile Include="Gumps\GumpSpriteImage.cs" />
<Compile Include="Gumps\GumpTextEntry.cs" />
<Compile Include="Gumps\GumpTextEntryLimited.cs" />
<Compile Include="Gumps\GumpTooltip.cs" />
<Compile Include="Gumps\RelayInfo.cs" />
<Compile Include="Network\PingListener.cs" />
<Compile Include="Persistence\Persistence.cs" />
<Compile Include="PromptExtensions.cs" />
<Compile Include="Random.cs" />
<Compile Include="Items\VirtualCheck.cs" />
<Compile Include="SpawnArea.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DSharpPlus" Version="3.2.3" />
<PackageReference Include="DSharpPlus.WebSocket.WebSocket4Net" Version="3.2.3" />
<PackageReference Include="DSharpPlus.WebSocket.WebSocketSharp" Version="3.2.3" />
</ItemGroup>
<ItemGroup>
<Content Include="servuo.ico" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ultima\Ultima.csproj">
<Project>{e08cfbe4-e013-44ee-8829-426d05bc083f}</Project>
<Name>Ultima</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="ServUO.exe.manifest" />
</ItemGroup>
<Import Project="..\VersionSpecificSymbols.Common.prop" />
</Project>
Pub57 probably won't work and i have no plans as of right now to support that version, you'll need something newer.
You can see if it works when you recompile the server itself and/or maybe change the .net version (not sure rn if 4.7.2 is high enough for DSharpPlus)
 
Pub57 probably won't work and i have no plans as of right now to support that version, you'll need something newer.
You can see if it works when you recompile the server itself and/or maybe change the .net version (not sure rn if 4.7.2 is high enough for DSharpPlus)



on which version of servuo does it work? and what is the correct version of the netframework?
Post automatically merged:

until a moment ago I was convinced that Pub57 was the latest version of servuo

servuo.png
 
on which version of servuo does it work? and what is the correct version of the netframework?
Post automatically merged:

until a moment ago I was convinced that Pub57 was the latest version of servuo

View attachment 18394
1629034592101.png
You can get it when you click on Code and then clone/download it (cloning recommended)
Pub57 is the latest release but not the latest version
 
View attachment 18395
You can get it when you click on Code and then clone/download it (cloning recommended)
Pub57 is the latest release but not the latest version
ok, i will try to do a test with this version. thank you
Post automatically merged:

on ServuoMaster it works. If in the future you found a solution to make it work on Pub57 it would be great. As many users use this version believing it to be the most recent.
 
Last edited:
Hi, there is a bug in your selectcharacter command:

first, :
C#:
            for (int i = 0; i < World.Mobiles.Count; i++)
            {
                Mobile m = World.Mobiles.ElementAt(i).Value;

generate exceptions :
C#:
System.ThrowHelper.ThrowInvalidOperationException: Collection was modified

instead use
C#:
            foreach (Mobile m in World.Mobiles.Values.Where(m => m.Player))
            {
no needs to iterate on all mobiles



Then here, you flag "endAndContinue" at true when account is found
and you continue

C#:
                bool endAndContinue = false;
                for (int x = 0; x < dul.Accounts.Length; x++)
                {
                    if (m.Account.Username.Equals(dul.Accounts[x].Username))
                    {
                        endAndContinue = true;
                        break;
                    }
                }

                if (endAndContinue)
                    continue;

Meaning you'll never set the selected character once found...
C#:
                dul.SelectedCharacter = m;
                DClient.UserManager.AddOrUpdate(dul);
                args.Channel.SendEmbedMessage("Selected your character").ConfigureAwait(false);
 
Hi, there is a bug in your selectcharacter command:

first, :
C#:
            for (int i = 0; i < World.Mobiles.Count; i++)
            {
                Mobile m = World.Mobiles.ElementAt(i).Value;

generate exceptions :
C#:
System.ThrowHelper.ThrowInvalidOperationException: Collection was modified

instead use
C#:
            foreach (Mobile m in World.Mobiles.Values.Where(m => m.Player))
            {
no needs to iterate on all mobiles



Then here, you flag "endAndContinue" at true when account is found
and you continue

C#:
                bool endAndContinue = false;
                for (int x = 0; x < dul.Accounts.Length; x++)
                {
                    if (m.Account.Username.Equals(dul.Accounts[x].Username))
                    {
                        endAndContinue = true;
                        break;
                    }
                }

                if (endAndContinue)
                    continue;

Meaning you'll never set the selected character once found...
C#:
                dul.SelectedCharacter = m;
                DClient.UserManager.AddOrUpdate(dul);
                args.Channel.SendEmbedMessage("Selected your character").ConfigureAwait(false);

Hey,
thanks for the info about the endAndContinue not sure how it ended up like that, will take a look at it at another time and change it

But about the
C#:
System.ThrowHelper.ThrowInvalidOperationException: Collection was modified

using a foreach loop would not solve that and instead cause the same exception
the issue lies within the .ElementAt(i) (foreach and .ElementAt both use IEnumerator where a for loop does not)
didn't think at the time writing the code that .ElementAt uses an IEnumerator too, will need to think about a diffrent approach to solve this probably
 
Last edited:
since he used Linq / Where he has a sub list of just players
Yes but that still results in the same error, try running this and see it for yourself:

C#:
class Program
{
    static void Main(string[] args)
        => MainTask().ConfigureAwait(false).GetAwaiter().GetResult();

    static async Task MainTask()
    {
        try
        {
            for (int i = 0; i < 100000; i++)
                _dict[i] = i;

            int next = 100001;

            Task.Run(ForEachLoop);
            Task.Run(() =>
            {
                while (true)
                {
                    _dict[next++] = next;

                    if (next == int.MaxValue)
                        next = 100001;
                }
            });
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }

        Console.WriteLine("Done");
        await Task.Delay(-1).ConfigureAwait(false);
    }

    static Dictionary<int, int> _dict = new Dictionary<int, int>();

    static void ForEachLoop()
    {
        try
        {
            while (true)
            {
                foreach (var pair in _dict.Where(x => x.Value > 2))
                {
                    int x = pair.Value;
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }
    }
}
 
DO NOT iterate over World.Mobiles for something this trivial.
Use PlayerMobile.AllPlayers - your CPU/RAM will thank me later.
 
Hi, there is a bug in your selectcharacter command:

first, :
C#:
            for (int i = 0; i < World.Mobiles.Count; i++)
            {
                Mobile m = World.Mobiles.ElementAt(i).Value;

generate exceptions :
C#:
System.ThrowHelper.ThrowInvalidOperationException: Collection was modified

instead use
C#:
            foreach (Mobile m in World.Mobiles.Values.Where(m => m.Player))
            {
no needs to iterate on all mobiles



Then here, you flag "endAndContinue" at true when account is found
and you continue

C#:
                bool endAndContinue = false;
                for (int x = 0; x < dul.Accounts.Length; x++)
                {
                    if (m.Account.Username.Equals(dul.Accounts[x].Username))
                    {
                        endAndContinue = true;
                        break;
                    }
                }

                if (endAndContinue)
                    continue;

Meaning you'll never set the selected character once found...
C#:
                dul.SelectedCharacter = m;
                DClient.UserManager.AddOrUpdate(dul);
                args.Channel.SendEmbedMessage("Selected your character").ConfigureAwait(false);
Both should be fixed now
 
I was able to get this to work with the p58-wip version of ServUO,1645118628009.png

But I could not get pub57 to work. I guess because of the way script/server are handled differently at runtime in p58 vs pub57 the Account script code is not availble to Server because it is in scripts, and the code throws errors. I did try a few different ways to get it to work but was running into issues either way.
It would be great if someone could get it working for pub57, a lot of servers still use these older cores, and the discord integration is amazingly useful.
 
Hey, sorry for the late response

the Account script code is not availble to Server because it is in scripts, and the code throws errors.

you are not supposed to place the code files into your "Server" folder but instead into your "Scripts" folder like shown on the wiki:

114487495-fdb6f300-9c0f-11eb-86bc-00e148cc7cab.PNG


What kind of errors does it throw?
 
I would love to use this or try to, however getting the following crash after adding those references.
C#:
Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at DSharpPlus.Net.DiscordApiClient.<GetChannelAsync>d__36.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at DSharpPlus.Net.DiscordApiClient.GetChannelAsync(UInt64 channel_id)
   at DSharpPlus.DiscordClient.<GetChannelAsync>d__240.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<>c__DisplayClass44_0.<<GetChannelAsync>b__0>d.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<RunSafeAsync>d__58`1.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 343
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<GetChannelAsync>d__44.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DiscLogger..ctor(UInt64 discordChannelId, TimeSpan cacheSendDelay) in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\Logging\DiscLogger.cs:line 28
   at Server.Custom.Skyfly.UODisc.LoggerFactory.GetLogger(UInt64 discordChannelId) in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\Logging\LoggerFactory.cs:line 27
   at Server.Custom.Skyfly.UODisc.DClient.Start() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 441
   at Server.Custom.Skyfly.UODisc.DClient.Initialize() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 153
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Server.ScriptCompiler.Invoke(String method) in C:\Users\Jonathan\Desktop\Test Server\Server\ScriptCompiler.cs:line 534
   at Server.Core.Main(String[] args) in C:\Users\Jonathan\Desktop\Test Server\Server\Main.cs:line 644
 
I've also tryed to get this to work on my server pub57.2 but have many error's when compiling any help would be greatly appreciated.
attached is the error file
 

Attachments

  • error uodisc.txt
    11.8 KB · Views: 3
  • error uodisc.txt
    11.8 KB · Views: 2
I would love to use this or try to, however getting the following crash after adding those references.
C#:
Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at DSharpPlus.Net.DiscordApiClient.<GetChannelAsync>d__36.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at DSharpPlus.Net.DiscordApiClient.GetChannelAsync(UInt64 channel_id)
   at DSharpPlus.DiscordClient.<GetChannelAsync>d__240.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<>c__DisplayClass44_0.<<GetChannelAsync>b__0>d.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<RunSafeAsync>d__58`1.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 343
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DClient.<GetChannelAsync>d__44.MoveNext() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Server.Custom.Skyfly.UODisc.DiscLogger..ctor(UInt64 discordChannelId, TimeSpan cacheSendDelay) in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\Logging\DiscLogger.cs:line 28
   at Server.Custom.Skyfly.UODisc.LoggerFactory.GetLogger(UInt64 discordChannelId) in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\Logging\LoggerFactory.cs:line 27
   at Server.Custom.Skyfly.UODisc.DClient.Start() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 441
   at Server.Custom.Skyfly.UODisc.DClient.Initialize() in C:\Users\Jonathan\Desktop\Test Server\Scripts\Custom\Custom Systems\UODisc\DClient.cs:line 153
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Server.ScriptCompiler.Invoke(String method) in C:\Users\Jonathan\Desktop\Test Server\Server\ScriptCompiler.cs:line 534
   at Server.Core.Main(String[] args) in C:\Users\Jonathan\Desktop\Test Server\Server\Main.cs:line 644

Netwonsoft.Json is missing, are you using the latest version or pub57?

I've also tryed to get this to work on my server pub57.2 but have many error's when compiling any help would be greatly appreciated.
attached is the error file

pub57 is currently not supported, your error says you did not install the "DSharpPlus" dependency (which is required since UODisc is using DSharpPlus as it's base). It's been quite some time since i last worked with pub57 so i cannot give you a tutorial out of my mind right now.

---


I'm currently pretty busy sadly but when i have enough time i will roll out an update which will probably also include pub57.
 
  • Like
Reactions: Rex

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back