1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Vote for us!

Remember to vote for ZEJ at our Top RP Sites page! You can vote only once daily, so make sure to do so and help us reach the top!

Making Fryborg Persistent: An Adventure in C#/.NET and Discord.NET

Discussion in 'Creation Station' started by Nebulon Ranger, Mar 8, 2017.

  1. Okay, so, if you've been on Discord at all, you may have noticed that every time someone makes a post in any forum outside of Random Jazz, fryborg peeks his robotic head in and posts a link with a post excerpt to #zej-updates. He can do this because, for the most part, fryborg is controlled by our Discord Integration addon. However, one thing Fryborg can't do is remain online if I close my browser. I aim to fix that and more with some C#/.NET magic and a Discord API implementation for C# called Discord.NET.

    Currently, the only code I have is code to make him stay online, but there'll be more added.

    Here's the current code, for the curious:

    Code:
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Discord;
    
    namespace Fryborg
    {
        class Program
        {
            // Engage main loop.
            static void Main(string[] args) => new Program().Start();
    
            // Define client.
            private DiscordClient _client;
    
            // Start bot.
            public void Start()
            {
                _client = new DiscordClient();
    
                // Use Discord bot token to connect.
                _client.ExecuteAndWait(async() => {
                    await _client.Connect("[REDACTED]", TokenType.Bot);   
                });
    
                // Make sure console window doesn't quit.
                Console.ReadLine();
            }
        }
    }
     

Share This Page