xeekworx / sdl_wikipediabot Goto Github PK
View Code? Open in Web Editor NEWThe Discord bot that displays SDL documentation using embed in the chat
License: MIT License
The Discord bot that displays SDL documentation using embed in the chat
License: MIT License
Currently the downloading and parsing of wiki content isn't verified. If the page isn't a wiki page or contains unexpected content, it will still try to parse and display it.
Currently downloading of wiki content or loading from wikicache is done in separate sections of code. The best way to handle this in the future would be to use a base class for wiki content loading and have two derived classes, one for loading from cache, one from loading live off of wiki.libsdl.org.
In the bot, a list of content searching objects would be used, the order in the list determines priority. The wikicache is first on the list and the wiki-download is after it. This means that the cache will be utilized before the live download.
class SDL_WikiContentSource:
def __init__(self):
self.source_name = "Unknown"
def query(self, value):
return None
class SDL_WikiContentCache(SDL_WikiContentSource):
def __init__(self):
self.source_name = "Cache"
def query(self, value):
return None
class SDL_WikiContentDownload(SDL_WikiContentSource):
def __init__(self):
self.source_name = "Live"
def query(self, value):
return None
Searching is currently not possible. The downloader simply takes the user's query (eg. SDL_RenderCopy) and build's a wiki.libsdl.org URL out of it to pull content. This feature would allow for searching the wiki and displaying results.
Maybe use !wiki_search for the command, or add an argument to the existing !wiki command (eg. !wiki search )
The actions and output of the Bot is not currently logged; though some things do get output to stdout. It should also be possible to cap the size of the log.
Currently, there is no limit to how big the wikicache file can get. This could be a problem. Two ideas:
The query given to the !wiki command isn't checked for anything that might be unsafe to use in a URL before that URL is downloaded. The simplest solution would be to just make sure only alphanumeric characters are used (plus the underscore), or what would be considered valid for function and type names in C/C++.
This should be simple to implement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.