kev123 132 Posted June 21, 2014 Report Share Posted June 21, 2014 I've been meaning to create this thread for a long while, ubot API has enabled ubot to become a lot more advanced. I'm sure there's a few people out there who would like to get started with the api for the odd function that isn't supported that they need. The purpose of this thread is for me and hopefully some of the others who have built plugins to help people get started with the api and maybe the odd group project. couple of questions Is the ubot api wiki page enough for people to get started or would you like a real world example in more detail?. Has anyone tried with the api what did you find difficult anything specific people would like to see many thankskev 1 Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted June 21, 2014 Report Share Posted June 21, 2014 This is a great idea. I almost got all the paid plugins released here. It's better if i can customize one for my needs.Tutorials on making plugins for c# newbies would be great kev. 1 Quote Link to post Share on other sites
jamesfar 15 Posted June 22, 2014 Report Share Posted June 22, 2014 This is a great idea. I almost got all the paid plugins released here. It's better if i can customize one for my needs.Tutorials on making plugins for c# newbies would be great kev. Agree +1 Quote Link to post Share on other sites
Bot-Factory 602 Posted June 22, 2014 Report Share Posted June 22, 2014 That would be great Kev. The main part that would interest me:How can I convert a regular C# app into an ubot plugin. What input variables do I need. How do I hand them over from ubot into the C# code.And what return values are supported and how does that work. So mainly a guide to convert a regular c# app (a small tool of course) into an Ubot plugin. Thant would be really great Dan Quote Link to post Share on other sites
kev123 132 Posted June 22, 2014 Author Report Share Posted June 22, 2014 ok cool i'll start with a simple getting started and setup with a easy example and then a converting a real world app over. Dan have you got the source code in mind you would like converting over? Quote Link to post Share on other sites
ubotter1 2 Posted June 22, 2014 Report Share Posted June 22, 2014 API is good overall - could not create "real world" advanced bots without it. It has 3 major shortcomings (at least) that I have experienced: 1) It allows you to create custom "commands" that integrate into UBS - nice - but you are only allowed to pass strings and list as parameters. Where is the most useful parameter type of a "selector"? If you want to pass a selector to your command, all you can do is a string. What is missing is for your custom command in UBS to have the "selector" capability built into the UI of your custom command in UBS - you know, the little icons that let you select an element or fine tune that selection - that is not supported in your custom command. Major oversight in my opinion. 2) Similarly, when working with a complex page, in C# there is no way to tap into the "selector" capability of UBS. All you can do is grab the entire HTML of the page in C# and perform your own DOM processing on it. Would be SO much easier to tap into the UBS selector capabilities. 3) Finally, you will get an annoying popup message regarding your "unregistered plugin" every time you run your bot - even if it is a "private" plugin you don't want distributed. I think you have to send them your source code or pay $100 or something like that - I don't know for sure because when I inquire to UBS they are very vague about it. Quote Link to post Share on other sites
kev123 132 Posted June 22, 2014 Author Report Share Posted June 22, 2014 1/2. browser interaction aren't part of the api as well as the UI. There is ways round this or so i'm led to believe but i haven't first hand experience doing so.3. you need to get a plugin key to stop them messages.for a open plugin that is shared for free on the forum -cost nothingfor a private plugin -cost nothing dependant on what it is for example if its something that's unique to you and not much use to anyone else it will more than likely be free.Plugin people have to purchase - paidThis is of course at ubots discretion, your key request may be rejected if its going to be included in ubot at a later date or your intentions are not clear about what the plugin will do. you can request a key here http://support.ubotstudio.com/index.php?/ I will cover the setting the plugin key up in the project for the first tutorial. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted June 22, 2014 Report Share Posted June 22, 2014 I like where this is going! Quote Link to post Share on other sites
Gogetta 263 Posted June 22, 2014 Report Share Posted June 22, 2014 + 1 Count me in. I would love to see more information on how to use the api. Quote Link to post Share on other sites
wilriv21 16 Posted June 27, 2014 Report Share Posted June 27, 2014 Kev, Another great idea and help to the community. Any progress? Regards,William Quote Link to post Share on other sites
kev123 132 Posted June 27, 2014 Author Report Share Posted June 27, 2014 Kev, Another great idea and help to the community. Any progress? Regards,Williamhi sorry got a little side tracked if I get chance tomorrow i'll do the getting started tutorial one if not next week Quote Link to post Share on other sites
the_way 52 Posted June 28, 2014 Report Share Posted June 28, 2014 when are we getting started on a plugin to save ubot files as a webpage script? Quote Link to post Share on other sites
kev123 132 Posted June 28, 2014 Author Report Share Posted June 28, 2014 1.0 Getting Started. Is this first part i'm going to explain how to setup the basics for a plugin and the software required.this will get everything ready for creating are first commands and functions in the next tutorial.Everything i'm going to explain is already on the wiki for this first tutorial but i'll run through them anyway. getting a plugin key as mentioned above you need to get a plugin key to be able to work with the api if you don't you will get the unreviewed message.While you are learning ubots api there's no need to get a key, I would suggest getting one when you have something that works.for a open plugin that is shared for free on the forum -cost nothingfor a private plugin -cost nothing dependant on what it is for example if its something that's unique to you and not much use to anyone else it will more than likely be free.Plugin people have to purchase - paidThis is of course at ubots discretion, your key request may be rejected if its going to be included in ubot at a later date or your intentions are not clear about what the plugin will do. contact support for a key http://support.ubotstudio.com/index.php?/ Reminder you don't need a key to learn the api only when you want a complete plugin without the unreviewed message. Software required download Visual C# 2010 express if you don't already have it from Microsoft. http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express download the api .dll file from ubothttp://www.ubotstudio.com/files/plugins/UBotPlugin.dll Creating the base file again the is covered in the wiki but so its easy to follow step by step i'll put the details here i'll add some helper comment. click file then new Choose the WPF Application template and name your project plugintemplate From the Solution Explorer delete App.xaml and MainWindow.xaml (the Solution Explorer is located on the far right) From the Main Menu choose Project -> plugintemplate Properties In the Application Tab change the Output type to Class Library (this is so the file created is the correct type .dll) From the Main Menu choose File -> Save All If desired, change the location where the project is saved. Make a note of the location as you will need it in a later step then click Save. From the Solution Explorer right click on the project and choose Add Reference. Select the UBotPlugin.dll downloaded in the first step and click OK (this is the file you downloaded from ubot) now where going to add a class for the ubot plugin api key. 1. in the Solution Explorer in the right hand side right click on the project name plugintemplate2.from the menu that pops up move to add and select new item select class3.rename class1 to PluginInfo by right clicking on it and selecting rename.4.click on the class (PluginInfo) the code should now be displayed delete everything.5.replace with the below code using System;namespace plugintemplate public class PluginInfo{public static string HashCode { get { return "Put your plugin key here"; } }} in the future when you get your plugin key it goes here. 6.save all that's about it we have created the base file we need for plugins in the next tutorial we will create a basic plugin and i'll explain returning data to and from ubot. Bonus but not requiredshould you want to create a template so that everytime you make a plugin you can select the pre created of the above.1.click file, then export template2.the wizard should open just keep clicking next until finish3.the export in a zip folder should open close this4.now when you click file ,new the template will be selectable5.when you save the plugin you are creating change the name as required. 4 Quote Link to post Share on other sites
UBotDev 276 Posted June 29, 2014 Report Share Posted June 29, 2014 Had 2 comments.... I don't think private plugin is free if you want it without unreviewed message. You can only get the key for free if you intend to share your plugin/code with others. I would also suggest all interested to check the wiki page which you don't mention/link to (a lot of useful examples for learning there): http://wiki.ubotstudio.com/wiki/Plugin_Development Quote Link to post Share on other sites
kev123 132 Posted June 29, 2014 Author Report Share Posted June 29, 2014 Had 2 comments.... I don't think private plugin is free if you want it without unreviewed message. You can only get the key for free if you intend to share your plugin/code with others. I would also suggest all interested to check the wiki page which you don't mention/link to (a lot of useful examples for learning there): http://wiki.ubotstudio.com/wiki/Plugin_DevelopmentI believe private depends on what it does for example should it have commands for your own say intranet system that's no use to anyone else and would be pointless sharing you may be eligible for a free plugin as stated in my comments. Thanks for linking to the wiki I reference it above but don't link. I'm trying to refrain from saying follow xyz on the wiki because speaking to a few people they would prefer things in small easy chunks and they have struggled with the wiki. Once I have finished the main three or four tutorials it would be great if people like yourself who also have worked with the API could offer up any tips they may have learnt, again after I have completed the first four tutorial which will explain most of the major parts of the api and basic c# stuff people will need to know to get values back and forth from ubot such as converting to integers etc. Quote Link to post Share on other sites
kev123 132 Posted June 29, 2014 Author Report Share Posted June 29, 2014 1.1 Creating a basic function.assuming you have completed the first tutorial complete the below In this tutorial i'm going to go over the basics to creating a ubot function for the demo i'm using a the read number of lines function from the advanced file plugin. 1.create a class (as detailed in the first tutorial if you cant remember)2.rename it to Readpartfile (as detailed in the first tutorial if you cant remember)3.delete the code in the class and add the below using System;using System.Collections.Generic;using System.IO;using System.Linq;using UBotPlugin;namespace advanced.file{public class FileLines : IUBotFunction{private List<UBotParameterDefinition> _parameters = new List<UBotParameterDefinition>();private string _returnValue;public string Category{get{return "Advanced File Function";}}public string FunctionName{get{return "file Number of lines";}}public bool IsContainer{get{return false;}}public IEnumerable<UBotParameterDefinition> ParameterDefinitions{get{return this._parameters;}}public object ReturnValue{get{return this._returnValue;}}public UBotType ReturnValueType{get{return UBotType.String;}}public UBotVersion UBotVersion{get{return UBotVersion.Standard;}}public FileLines(){this._parameters.Add(new UBotParameterDefinition("Location", UBotType.String));}public void Execute(IUBotStudio ubotStudio, Dictionary<string, string> parameters){string path = parameters["Location"];int test = File.ReadLines(path).Count(); this._returnValue = test.ToString(); }}} 4.watch the tutorial video explaining the basics to how everything works. I don't go into a massive amount of detail but you should be able to edit the template above and create a basic function following the video also in the video I say a loop is a function opps sorry not trying to confuse things. 5. I briefly explain in the video where to get the plugin from once complied.to go into more detail you need to select the project folder(where you saved the project), then select the bin folder and the compiled plugin will be in either debug or release folder depending on your settings in Microsoft visual c#. I tried to not use much c# programming terminology to help the less experienced people so sorry to people with c# experience if some terms I used weren't what things would normally be called. 1 Quote Link to post Share on other sites
UBotDev 276 Posted June 29, 2014 Report Share Posted June 29, 2014 I believe private depends on what it does for example should it have commands for your own say intranet system that's no use to anyone else and would be pointless sharing you may be eligible for a free plugin as stated in my comments.As far as I know that's not true. Here is a quote from an email that I got from Jason a while ago: If you wish to create open source plugins that are free to everyone, you may have as many free plugin keys as you have ideas for open source plugins. If you wish to develop a plugin privately to give away or sell, you are allowed to do so, but you must pay for your use of the API. (This is a similar model to the one github follows.) If you merely want to make a plugin for your own use, you may consider making it open source so that others may enjoy its benefits as well. If you need it to be private, you are free to build the plugin without a key and try to ignore the nag screen. If this is unacceptable, I apologize, but these are the terms we've chosen for distributing keys. So I'm not sure where you are getting that information from. Above it is clearly stated that you need to pay for private plugin if you don't intend to share it with other users/making it open source and you want to get rid of that annoying "un-reviewed" popup. Thanks for linking to the wiki I reference it above but don't link. I'm trying to refrain from saying follow xyz on the wiki because speaking to a few people they would prefer things in small easy chunks and they have struggled with the wiki. Once I have finished the main three or four tutorials it would be great if people like yourself who also have worked with the API could offer up any tips they may have learnt, again after I have completed the first four tutorial which will explain most of the major parts of the api and basic c# stuff people will need to know to get values back and forth from ubot such as converting to integers etc. If you talk about plugins I think that should be the first page you link to, in case anyone doesn't know about it yet, since examples there nicely demonstrate most of the features of the so called API (that's why I felt I should add it). Else thumbs up for opening this thread. Sure, I can give my few cents, just didn't want to steal the topic for now. I hope that other plugin developers will also be willing to contribute here... Quote Link to post Share on other sites
kev123 132 Posted June 29, 2014 Author Report Share Posted June 29, 2014 If you wish to create open source plugins that are free to everyone, you may have as many free plugin keys as you have ideas for open source plugins. If you wish to develop a plugin privately to give away or sell, you are allowed to do so, but you must pay for your use of the API. (This is a similar model to the one github follows.) If you merely want to make a plugin for your own use, you may consider making it open source so that others may enjoy its benefits as well. If you need it to be private, you are free to build the plugin without a key and try to ignore the nag screen. If this is unacceptable, I apologize, but these are the terms we've chosen for distributing keys. So I'm not sure where you are getting that information from. Above it is clearly stated that you need to pay for private plugin if you don't intend to share it with other users/making it open source. ok maybe when I asked it was before policy's where introduced or my question wasn't clear to support it was a while ago. Bonus tip from the tutorial aboveBit of a obvious one disable all other plugins to speed things up. You don't need to do this but if you going back and forth testing your plugin it will save having to load all the other plugins in ubot everytime you add you plugin. Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted June 29, 2014 Report Share Posted June 29, 2014 Nice kev. Keep the tutorials coming! Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted June 29, 2014 Report Share Posted June 29, 2014 Topic has been pinned to help others. 1 Quote Link to post Share on other sites
giganut 109 Posted June 30, 2014 Report Share Posted June 30, 2014 Wow this is a great thread, subscribed Quote Link to post Share on other sites
ubotter1 2 Posted June 30, 2014 Report Share Posted June 30, 2014 As we (all) know, the most efficient way to create multiple but related software solutions is to create and maintain your own common "base classes" which you can share among your projects and the developers who work on them. Also, as we all know, UBot does not provide such capability natively. (if you think Private Bot Bank is the answer, you have not tried to scale it among multiple projects and developers). UBot Plugin DLL capability is the best solution available for creating common, re-usable pieces of code you can leverage into your multiple projects. Being able to use native .NET scripting (as opposed to the awkward UBot script) is definitely the way to go, too. That being said, the fact that UBot wants to charge me to use this feature for my own private projects - never intended to be sold or of any use to others - is not only annoying, it is shortsighted. This is a powerful enhancement to their product. Without it, we would have abandoned UBot long ago. But, this discouraging practice of UBot to "nag" you for implementing better programming techniques is silly. We need to request UBot re-think this policy. Regards to getting a key, how much does it cost anyway? When I inquired, the response was "we'll determine that after you show us what you are doing". Well, 1) they should be able to tell me the price, and 2) I have no intention of sharing my DLL code (which I use privately) and have obligations with clients preventing sharing such. I don't understand their position on this. It makes one think that coding directly against the AWESOMIUM.DLL that UBS is based on is the way to go. As I said, the ability to extent UBS with .NET coding is EXTREMELY powerful. I don't know why they are trying to squash this instead of helping promote it. 2 Quote Link to post Share on other sites
ubotter1 2 Posted June 30, 2014 Report Share Posted June 30, 2014 To follow up from my post above, I am following this topic, and when it progresses past the "basics" (which are really covered pretty straightforward on the Wiki), I will be happy to chime in with any tips or experiences that might help. Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 30, 2014 Report Share Posted June 30, 2014 Good job Kev!! keep it going man!! it's going to be great.... Quote Link to post Share on other sites
Brutal 164 Posted January 12, 2016 Report Share Posted January 12, 2016 It is a shame this thread died - Come on ALL plugin makers, we all know you guys are the bees-knees.... Share the wealth and give us some walk throughs! Or hell, offer coaching for a fee! A lot of us want to do this but it still buzzes over our heads. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.