Coder Social home page Coder Social logo

thekingeagle / rmsoftware.modularbot Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 44.86 MB

A Multi-purpose bot for discord. Tailor it for your specific guild, and create your own modules. Includes a core module for custom text-based commands with support for advanced functionality

License: MIT License

C# 97.94% HTML 0.12% CSS 1.94%
bot csharp customizable discord discord-net multi-purpose using-discord-net

rmsoftware.modularbot's Introduction

Greetings

Welcome to my corner of this digital domain!

I love music, technology, games.

I want to learn new things

What I do

  • Indie/Hobbyist Software Dev
  • Dev for an awesome survey site (Rewards1)
  • Composer

My Stack

CSHARP .NET html5 CSS angular Nodejs JavaScript PHP MySQL

GitHub Stats

kingeagle

Why is this broken.?

Top Languages

Top Langs

rmsoftware.modularbot's People

Contributors

dependabot[bot] avatar thekingeagle avatar

Watchers

 avatar

rmsoftware.modularbot's Issues

Console RSKILL does not always restart

Description
RSKill will show a test kill screen that will act like it restarts AND triggers a natural stopbot command.

To Reproduce
Steps to reproduce the behavior:

  1. Run RSKILL via console.
  2. Wait 5 seconds for restart to be called.
  3. Observe the randomly fired additional 3 second count down.
  4. Note the graceful exit without restart

Expected behavior
Program should ALWAYS restart after calling rskill.

Additional context
This is very random, and I am actively looking for ways to fix.
These self-created issues are for documentation purposes.

startup.core overwritten

Full description
Updating ModularBOT via installer will overwrite existing startup.core

To Reproduce
Steps to reproduce the behavior:

  1. Modify your startup.CORE
  2. run modularBOT installer.
  3. open startup.CORE
  4. see it overwritten.

Expected behavior
startup.core is to be left untouched by installer.

Desktop:

  • OS: WINDOWS (All supported versions)

Workaround (until fixed next version)
Always backup your data prior to any updates. Next version will fix this issue via installer.

Comments in CoreScript trigger errors.

I am working on a fix for that. As of right now, do not use them. As we all know, the CoreScript is heavily based on BATCH syntax, but integrates custom features. Comments will eventually take on three forms.

:: double colon - Batch
//double forward-slash - C# (and others)
REM <comment> - batch

File Write Problems... Permission System

Overview
Application will randomly fail to write permissions.cnf due to it "already being open".

To Reproduce

  1. Start the bot
  2. Flip a coin.
  3. If(flip.Result == CoinFlipResult.Heads) { Throw (new System.IO.IOException)};

Expected behavior
File writing doesn't fail randomly

Desktop (please complete the following information):

  • OS: Windows 10 Pro. | Windows Server 2012-R2
  • ALL versions implementing Permission System.

Additional context
A Vast majority of these File IO errors take place during guild synchronization.

CoreScript: SET /P Hijacked prompts

Problem Description
SET /P only responds to the last caller of any command invoking that script function. This leads to an easy hijacking of the original call

To Reproduce
Steps to reproduce the behavior:

  1. Add the following commands:
    !addcmd tprompt1 false SCRIPT
ECHO Test #1:
SET /P prompt1_1=This is question one. Have someone call !tprompt2, then answer this prompt. Observe that you no longer have control of this prompt after the second one is called.
ECHO Prompt 1 answer 1: %prompt1_1%
SET /P prompt1_2=This is question two of prompt 1. Do you read me?
ECHO Prompt 1 answer 2: %prompt1_2%

!addcmd tprompt2 false SCRIPT

ECHO Test #2:
SET /P prompt2_1=This is question one of prompt 2. Observe that you will have control of BOTH prompts.
ECHO Prompt 2 answer 1: %prompt2_1%
SET /P prompt2_2=This is question 2 of prompt 2. Do you read me?
ECHO Prompt 2 answer 2: %prompt2_2%
  1. Call !tprompt1
  2. Have another user call !tprompt2
  3. See that other user has control of both prompts.

Expected behavior
Both commands should accept prompt replies from the calling users respectively, at the same time.

Affected Versions
v2.0.1155.2346 Onward.

Additional context
This leaves the entire system un-usable if the bot is in multiple servers calling the commands at the same time. A solution is being worked on at this time.

Service Constructors are called multiple times.

Describe the bug
Module Service constructors are called more than once on startup.

To Reproduce
Steps to reproduce the behavior:

  1. Start the bot with TestModule
  2. Observe the console for constructor call messages.

Expected behavior
All modules with service dependencies, should only call said dependency's constructor once.

Additional context
There's a super rad, and easy work around to the problem. bool doonce;. BUT I'm making note of this if anyone out there has any idea as to why this happens.

ConsoleIO Glitches

Describe the bug
Occasionally the Console will output and cause UI to garble. This has been an on-going issue since v1.0.
Occasionally Console position isn't registered, so ConsoleIO will not properly set cursor position back when issuing restart or shutdown commands. Some Command input text is also left on screen if it exceeds the length of the output result, that is supposed to overwrite what the user input.

Text will also garble if the window is resized to larger than buffer. Windows 10 only

To Reproduce
Unfortunately this seems to happen at random. Typically if console is resized, or if too many write events try to happen at the same time.

Expected behavior
Console output is CLEAN, and free of line mismatching.
ScreenBusy, and Busy wait conditions were added to try and minimize this, but this does not always work.

Screenshots
Fail01

Desktop Environments:

  • Windows 10 Professional
  • Windows Server 2012 R2
  • ModularBOT v1.0 thru current.

Additional context
Add any other context about the problem here.

IF Statement FAILS on string compare with spaces

Description
IF Statments will always return FALSE if you compare a variable with a string with spaces in it.

To Reproduce

  1. run the following script:
SET init=this is a test.
IF %init%==this is a test. ECHO This won't be said
  1. Observe that there is no output in the chat, because the conditional returned false.

Expected behavior
String compare should consider the FULL string rather than one word.

Affected Versions

  • v2.0.1225.2416 and later.

Known workaround
Only compare variables. IE:

SET /P user_response=enter your nickname
SET /h easteregg=The King Eagle
if %user_response%==%easteregg% ECHO Oh you are developer!

Discord.NET: User cache empty

Description
The userlist is only returning one user (the bot.) This has a cascading effect on modules requiring a user as a parameter.

To Reproduce
From console: access any guild's userlist.

Expected behavior
ALL USERS TO BE SHOWN IN THE USER LIST

Additional context
This is likely an API-side issue.

Occasional Deadlock During Login

Description
The program shuts down due to a network connection issue. On restart, the app will lock up at the Discord Discord.Net v2.2.0 (API v6) log entry. This is likely an issue with discord's API during the login call.

To Reproduce
You can't reliably reproduce an issue related to a discord/network outage.

Expected behavior
The program is expected to time out and try again if the instance isn't fully started in a reasonable time.

Affected version
v2.4.33.3241 and below

Additional context
TODO: Try moving timeout start before discordNET class initialization.

Users list does not initially display all users

Description
Running the users command will list most, but not all users on the first try. (For large guilds)

To Reproduce
Steps to reproduce the behavior:

  1. enter console command users <guild id>
  2. exit list
  3. repeat step one
  4. See there are now more available pages.

Expected behavior
The list should be complete on the first call.

Additional context
This has an easy workaround, and will probably not be solved immediately.

CoreScript startup.core will fail it contains blank line

Description
CoreScript engine will throw an Unexpected Function error in startup.core if the file contains white space/blank line.

To Reproduce
Steps to reproduce the behavior:

  1. Modify startup.core by inserting a blank line anywhere.
  2. Restart bot
  3. See malformed error.

Expected behavior
Whitespaced or blank lines are to be ignored.

Screenshots
Example error

Additional notes
This self-assigned issue was created for my own documentation. It will be fixed in the next release, after test instance finishes verification process for discordbots

CoreScript exploit

Description
There is a potentially critical scripting exploit that can allow the creation of a custom command that any user can execute and run live-typed scripts.

To Reproduce

  1. Add a custom command (prefix depending on location).

!addcmd echo false {params}

  1. Type new command into discord.

!echo SCRIPT ```DOS
echo I am executing a live script.
echo I also have unrestricted access to scripting function.
botstatus Oops! Someone left a huge hole in their permission system!
```

Expected behavior
The script engine should restrict certain functions to specific access level requirements.

Additional context
This is going to be fixed soon but until then proposed workaround:

  • Restrict any echo commands to a specific access level requirement.

External Module Commands "success" but no execution [Startup.core]

Summary
Any module command loaded from modules folder will fail to execute in startup.core

To Reproduce

  1. Ensure TestModule is in modules folder
  2. Open startup.core
  3. insert a command from module that also has a service dependency (CMD polljoin <your guildID> <your channel id>)
  4. save then restart bot.
  5. Notice a success message in console but no actual command is performed.

Expected behavior
Command debug messages and actions are executed as requested.

Resolution
After adding a FirstChanceException handler, it was noted that the requested dependency was not found, and the module could not be loaded. This was caused by calling module loader after CustomCommandManager (thus including CoreScript) was already fed with a previously built service provider.

ConsoleIO Writes LOG messages to a modal dialog.

Describe the bug
ConsoleIO's modal dialogs are being written under by consoleIO.WriteEntry after you close a nested dialog.

To Reproduce
Steps to reproduce the behavior:

  1. Type console command guilds
  2. Select any guild [ENTER]
  3. Select any of the "View" options [ENTER]
  4. Exit that new view menu [E]
  5. Send a command to the bot in a discord channel
  6. OBSERVE output being appended to the bottom of the guilds screen.

Expected behavior
ConsoleIO is to respect modal check, and keep console logs from appearing on the sub-screens.

Screenshots
https://kingeagle.rms0.org/rZSHTlfB.png

Affected Versions
ALL

Auto Configure Recommended Shard count

Is your feature request related to a problem? Please describe.
YES. As ModularBOT is added to more guilds, the risk of running out of space on a shard increases.

Proposed Solution
Have ModularBOT Determine how many shards should be needed BEFORE connecting to the gateway.

Current alternative/workaround
As it stands right now, it's Trial and error. If bot fails to start, Simply open install directory, and edit file modbot-config.cnf and increase ShardCount until gateway is happy.

Additional context
SEE //TODO:... DiscordNET.cs --- line: 69 Located in ModularBOT.csproj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.