Jump to content

My DU-themed Discord Bot


yamamushi

Recommended Posts

(now for another infamous several-pages-long yamamushi post...)

 

Hi Everyone,

 

I know this isn't the normal type of "Fan Art" that gets posted here but seeing as how Dual Universe was the only reason I created this thing, I figured it was subforum-worthy.

 

For the past several weeks I've been working on a bot for the Dual Universe Community Discord that I help run (with plenty of help from others on the discord staff like Sunrider, ComradeMoco, Soarnir, Dark, Kurock, Wilks Checkov, Zamaro de Metus, Haunty, Wardion2000, Code24, Anonymous, Cybrex, Khaymann and Spamfox - and if I forgot you I'm extremely sorry). I don't want to say I "own" it because really it's you, the community, that make it possible. Without community involvement, it would just be another empty discord out there. 

Also a special thanks to @Kurock for helping me with a bytes-to-timestamp conversion method the other night as I was half awake. 

 

 

And now that it's in a somewhat usable state (a point which could be argued against, haha), I'd like to "show off" some of the things I've put into it, describe some of the features I have planned for it, and get a feel for what people might want out of it. 

 


I'm quite aware that many of these features already exist in other bots, but my goal was to try to consolidate the features we use the most to try and replace the bots we have that don't quite go all the way I'd like them. One major example of this is Tatsumaki's credit system, as the credits you get can be used for buying things for your profile but that's about it. 

 

 


Before diving into it all, anyone is free to look through the 10k+ lines of source code on the GitHub repo for the project:

 

https://github.com/yamamushi/du-discordbot

 

I don't think many people here are that interested in contributing, but hey if someone is feeling adventurous enough to learn some Go they are more than welcome to make pull requests against the repo. In fact, I've documented the project fairly heavily throughout the Github Wiki for that purpose.

 

All of this runs inside of a docker container at the moment, and is fairly simple to setup and deploy. I find the whole process way easier and cleaner than many of the python based bots I've seen, but that's just a personal preference I'm sure. I attempted to refactor it into a more distributable scalable model, ended up writing a p2p publish/subscribe system, and realized it was overkill for a Discord bot and fell back on the model that I originally wrote it around. I even looked into using an actor framework for Go (thinking about the C++ Actor Framework DU uses), but even that would be way too much overkill for something as low latency and simple as a Discord bot. 

 

 

 

 

So what is DU-Discordbot useful for, other than annoying people with spam? :P


1) First off, the bot has an internal permissions system that is separate from any permissions distributed on Discord. It is all stored in an embedded database so that it's actually fairly trivial to transfer to another discord (useful during testing especially). It also means that I can hand out permissions on the bot without having to hand out permissions on discord itself (thus maintaining a separate layer of accessibility). 

 


2) The bot has an internal wallet and banking system (with a forthcoming "loans" system). Not only can you spend credits out of your wallet (for which there are few uses for at the moment), but you can store them in your bank account for safe keeping (more to come on that in the future). I'd like to wrap this into a "prize" system wherein active discord users can spend their credits on things like steam games or other random goodies. "Credits" cost nothing to users other than just being active on discord, and the only person paying for any of this is me. It's effectively my way of acknowledging people who are active in chat for being such a cool group of people. 

 

YAwcjcq.png

 

IlaUJrt.png

 

 


3) Chess! - The bot has an internal Chess AI (that arguably needs a ton of polish) that will play chess against a user. You can spend credits on new chess piece styles, configure your board how you want to play (with or without helper plots). The board is displayed using Discord Emoji's even.

 

okMXBDl.png

 

 

7Groe52.png

 

apxzUCt.png

 

 


4) Phases of the Moon. The bot will display the current view of the moon from the Earth in ASCII.

 

 

GjXH1CG.png

 

 

 


5) LUA interpreter. I'm fairly certain this is the only one of its kind on Discord, but I could be wrong because I've been doing this all in golang... I've added a LUA interpreter with some safety checks (no infinite loops, no long running processes, caps on the stack size, etc). It's not the greatest thing in the world, but it certainly gets the job done. It's not terribly useful to most people at the moment, but I anticipate as the game rolls out that people may find more value in it for testing or to share various code snippets.

 

ttegCQ4.png

 

 

 


6) Forum Integration. The bot retrieves posts from the forum every 5 minutes through the RSS feed we have access to. Every single post that arrives on the forum that pushes a thread to the top will show up in our #forum-posts room now, neatly formatted with a link to the comment in question. I've actually found that this has been incredibly useful to me, as the forum's new post page is somewhat... lacking.... Using this feature I get near instant updates on all the happenings on the forum :-)

 

0m1lauk.png

 

 

 

 

7) Twitter Integration. It still needs polish, but the bot attempts to retrieve live twitter updates from JC's Twitter feed and also from the DualUniverse twitter feed. Because this relies on a 3rd party RSS service, it tends to have issues that are out of my control.

 

kdTaZwO.png

 

 

 

 

8) Youtube Audio streaming. This was a big one for me to try and tackle, both so I could learn a thing or two about Opus audio encoding, and so I could learn how the voice system works in Discord. It's in a pretty preliminary stage (there are tons of features I want to add around it) but for now, it will download and live encode audio from youtube videos and stream them over a voice channel. It also has the ability to pause and restore songs. All of the audio encoding is done through golang without having to use ffmpeg like some bots rely on. After some heavy work cleaning up the memory allocation, I find it uses at most about 20mb of ram as opposed to the 300mb+ it was using while writing it. I've been pretty happy with the way it turned out (although Discord audio streaming ends up choppy at times no matter what simply because it wasn't really built for this kind of thing). 

 

GrRTfrk.png

 

7tZwOUO.png

 

 

 

9) Countdowns - Countdown timers to important "DU Dates". Currently lists the days until Founders pledging ends, until the beginning of September and until the end of September. September's dates are included because NQ said they were still on track for a September Alpha, so I figured it would be in between those days. 

 

7XfZfRx.png

 

 

 

10) Easter Eggs - There are a few easter eggs hidden around the bot's commands. Celery Man is there, for example.

 

 

11) DevDiary - The "devdiary" command will display the DevDiary for the supplied month and year:

 

6cjQQjt.png

 

 

 

12) Interviews - The "interview" command will either display a list of interviews with NQ, or will display the interview for the ID supplied:

 

KwVoBGv.png

 

 


That's all I've been able to knock out over the last week, with plenty of downtime to spare in-between sprints of coding till 5 in the morning (I even dreamt about handler functions in a library, woke up and spent 2 hours trying to find them before realizing it was all a dream I had and ended up having to write them myself based off the things I remembered from my dream). However, there are plenty of other features on my task list (on top of the unfinished work and polishing needed on the above features):

 

  • A Casino - We need real games of chance, like poker (which I don't know enough about poker to attempt yet), blackjack, slots, roulette, etc. 
  • More Games! - Checkers, PVP chess, slots, hangman, whatever fits here I'm very open to
  • A Prize system for spending the credits from winning games - previously discussed
  • Reminders / Notifications - Setting personal reminders with ~remindme 5 days "pledge to dual universe" 
  • MyCroft.ai Integration - For natural language processing, so you can ask the bot to do things with natural language like "what time is it in Tokyo?" or "find me a video of a puppy eating a carrot". I'm actually relying heavily on my experience with integrating MyCroft for a cool project at work :D
  • Dual Universe Wiki Integration - I would like to be able to query the wiki for things in real time from the bot.
  • Dual Universe Resource Guide - When the game is playable, I'd like to catalog various DU resources into an easily accessible system in the bot.
  • Wireframe Globes - Using this library to not only generate earth wireframes, but also wireframe models of Alioth - https://github.com/mmcloughlin/globe
  • An Alpha Countdown - For when we have a clear date to look forward to for Alpha. 

 

 

Like I said, I am quite aware that many of these features already exist in other bots, but I wanted to try and slowly pull all of those features together into one single bot that was more focused towards DU specifically.

 

I am eager to hear from people what kind of features they would like in the bot, as that kind of feedback keeps me motivated to keep working on it and adding more things. I know plenty of people have already seen it in action, but I mostly just hear people complaining about it haha (half joking...half...). 

 

I'd like to continue to add more DU-focused features (things like the forum integration have turned out very useful), but most of those will have to wait until Alpha is out and we have a better idea of the kinds of things we'd like easy references for.
 

 

jBurDwm.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...