Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

Tool Discord Bot For Wynn-utility Commands! (moto-bot)

Discussion in 'Your Work' started by motoki1, Apr 4, 2018.

Thread Status:
Not open for further replies.
  1. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    [insert some cool header here]
    A Discord Bot dedicated to Guild commands! You can invite the bot to your own server and use it there!
    This is my legit first Java project to actually code something useful, so please note that bot may have a lot of bugs and might not work correctly at some occasions.
    Other than that, have fun!


    Bot Info

    Name: moto-bot
    Author: @motoki1
    Latest bot version: 1.10.0_v394 (Development discontinued, as of late 2018)
    (Join the bot support server from command >info, if you need help.)


    Some original concepts inspired from:
    WynnBot by @315Lukas
    WynnStats Bot by @Infernis264



    Bot Invite
    > Click Here <
    This will require you to have "Manage Server" permission on the server to which you will invite the bot.
    The bot requires these permissions to work correctly:

    • Read / Send Message: Well, obviously.
    • Embed Links: To create a better view of command outputs.
    • Read Message History / Add Reactions / Manage Messages: To manage multiple page command output with reaction interactions. Example commands: >help, >g levelrank etc...

    Commands List

    • General
    >info : Shows the bot's info.
    >help : Shows available commands list.
    >prefix [new prefix] : Sets a custom prefix for the channel.
    >timezone [number] : Sets timezone for the channel, for easier view of time stamps in other commands.
    >ignore : Sets the bot to ignore commands sent in a channel. Type this command again to un-ignore a channel.

    • Wynncraft
    >up : Lists all up Wynncraft servers in order of their uptime.
    >servertrack [start/close] [all] : Sends track messages of Wynncraft server starts/closes to the channel.
    >find [player name] : Checks if player is on any Wynncraft servers.
    >stats [player name] : Shows player's general information.
    >wynnhorse [tier] [number] : Simulates breeding horse, and calculates the average price.

    • Items
    >item, >i : Show an item stats.
    >identify, >id : Search and identify an item. For fun.
    >dps : Search and show dps of a weapon.

    • Guilds
    >g terrtrack [guild name] : Tracks a guild's territory interactions. If no guild name given, tracks all guild's interactions.
    >g wartrack [guild name] :Tracks a guild's war activities. If no guild name given, tracks all guild's war activities.

    >g stats [guild name] : Shows guild's general information.
    >g territory [territory name] : Shows territory's info and previous owner history.
    >g tlist : Shows all territory list.
    >g tlist [guild name] : Shows guild's territory list.

    >g rank : Shows all guild's ranking by territories.
    >g levelrank : Shows top guild's ranking by levels.
    >g xp : Shows top guild's ranking in order of amount of XP gained over last 24 hours.

    >g warstats [guild name] : Shows guild's war activities.
    >g pwarstats [player name] : Shows player's war activities.
    >g pwarstats [player name] -g [guild name] : Shows player's war activities. (Specify a guild)

    >g territoryactivity [time range] : Shows territory takeover activities.
    >g war :Displays all war servers, which guild and how many players are in it.
    >g mylist : Manages your own custom territory list, to view a set of territory stats at one time.
    >g customList : Manages your own custom guild list.

    >g leaderboard : Guild war leaderboard of last 30 days.
    >g playerleaderboard : Player war leaderboard of last 30 days.


    For more, please use '>help' command on Discord!


    Screenshots
    Here's a few screenshots of me using some commands.

    For some more, visit this imgur album: https://imgur.com/a/44mWg
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]


    Other Information
    • Policy
    The bot can read every message in the channels bot has access to, so bot owners basically have access to all of those. However, I haven't made the bot to log your private messages on a guild, except command inputs. I may use users' command input logs to see which commands are being used a lot, and reduce lag / improve features.
    • Hosting / Uptime
    I'm hosting this bot on Heroku, so basically it's up for 24/7. It should also have (at least) better security than hosting it on my own personal computer. If the bot don't respond to your command inputs, it's highly likely due to a fail in my code, otherwise the host is down (try ">ping" to see if the bot's alive). If you ever need any help for the bot, join the bot support server and contact me there.
    • Programming and stuff
    The bot is written in Java, using JDA (Java Discord API). I'm fairly new to programming at this point, not even 2 months have passed since I started learning Java (as of Apr 5th, 2018). I started coding the bot at around the beginning of March 2018, and now I'm here to share you what I made. Why I chose Java to build a Discord bot? Well, there's no exact reason to that, but if I were to say, Java was the closest language to me before I look into more of the programming world. Minecraft is coded on Java, too.
    • What exactly is bot actually doing?
    Basically, other than actively responding to your command inputs, the bot requests the Official API every 30 seconds and fetches Online Player / Territory list. Then it scans through the list, checks active war servers and territory interactions.
    The bot also shows the amount of players online at the moment on Wynncraft on its status (e.g. 'Playing Wynn 500 Online').
    The guild leaderboard / guild / player data fetched from API is cleared / updated every 5 / 15 / 60 mins.
    Item DB is loaded on every restart of the bot, but I can also manually reload it if needed.
    Territory owner history for each territory is stored up to last 500 owners.
    Precise data of guild war history (such as join/end time, who joined war server etc.) is stored up to 90 days. Total number of wars done by a guild is permanently stored even if old precise war data is lost. However, for player war data, its total war numbers only count the last 90 days, unless "-all" argument is appended to show the total war number for a player across all guilds and time.
    I think that explains a good portion of what the bot is actually doing inside.


    Change Log
    (Visit bot support server for more)

    v1.8.0 release

    General
    ・New command ">g leaderboard", ">g playerleaderboard" : Shows guild/player leaderboard, finally. Please refer to in-command help (>g lb help, >g plb help) for more precise usage.
    ・Territory list is now requested and processed first instead of online players list now (and improved logic a little bit), so that might either improve war logging or cause more bugs (or both).
    ・The bot will now notify you when an unexpected error has occurred on command processing, so you no longer have to wait for the response awkwardly when it caused error inside.

    Guilds
    ・Command input ">g [guild name]" is now a shortcut for ">g stats [guild name]".
    ・Although guild names/tags are case sensitive, it can now search ignoring cases when no guilds matched with the input name first in case sensitive search.

    For more changelogs, visit the bot support server by typing command ">info".



    That's it! I hope you enjoy ;)
     
    Last edited: Dec 30, 2018
  2. Kokaga

    Kokaga Maho ❤ | J6's slave HERO

    Messages:
    156
    Likes Received:
    759
    Trophy Points:
    75
    Guild:
    Minecraft:
    Well, this already looks really neat even though I don't do that much guild stuff.
    Me likey
     
  3. Lex!

    Lex! :] CT Manager QA GM CMD CHAMPION

    Messages:
    1,202
    Likes Received:
    4,702
    Trophy Points:
    164
    Creator Karma:
    Minecraft:
    hi can you add a failsafe so something like this doesnt happen:
    Screenshot_12.png
    Screenshot_13.png
    Screenshot_15.png

    thanks
     
    YYGAYMER likes this.
  4. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
  5. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    Update! v1.1.0

    General

    • >prefix command now requires you to have Manage Server permission on the server.
    • Custom prefix cannot be set to longer than 10 characters.
    • Timezone offset now requires to be set in -23 ~ +23.
    Item searches
    • >id [item name] -re : Add "-re" to show reaction menu and keep re-identifying the item. Example: >id Gale's Force -re
    • Add "base" or "b" to the last of item search commands to only show base values. Example: >ib, >itembase, >idb, >dpsb
     
  6. PikaLegend

    PikaLegend Shocking VIP+

    Messages:
    524
    Likes Received:
    965
    Trophy Points:
    91
    Minecraft:
    This is amazing, I just tried it out and it was so neat and nicely presented!
     
  7. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    v1.3.0 release : May 13th, 2018
    Guilds

    • Added ">g TerritoryActivity" command, this allows you to see territory takeovers in a specified amount of time.
      • Example usage: >g ta 1d, >g ta 7d13h
    • ">g stats" command now shows guild banners!

    The bot will now show guild banners with ">g stats" command, enjoy :D
     
    Nickel likes this.
  8. Saya

    Saya you win at uwynn HERO

    Messages:
    2,930
    Likes Received:
    6,871
    Trophy Points:
    209
    Guild:
    Minecraft:
    Nice! I guess I'll be using this!
     
    motoki1 likes this.
  9. Hyco

    Hyco Well-Known Adventurer CHAMPION

    Messages:
    817
    Likes Received:
    552
    Trophy Points:
    97
    Guild:
    Minecraft:
    You did a great job on this! :)
     
    motoki1 likes this.
  10. WynnChairman

    WynnChairman Chairman of Wynn HERO

    Messages:
    3,452
    Likes Received:
    2,675
    Trophy Points:
    136
    Guild:
    Minecraft:
    can u add a way to disable the 24hour clock for war logs?
     
  11. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    You should be able to make it display war-logs in 12-hour format, just do ">timeformat 12h" in the war-log channel.
    Also, assuming the channel does not have the specific setting, you can do guild-wide setting with ">timeformat 12h guild".
     
  12. WynnChairman

    WynnChairman Chairman of Wynn HERO

    Messages:
    3,452
    Likes Received:
    2,675
    Trophy Points:
    136
    Guild:
    Minecraft:
    oh ty xd
     
    motoki1 likes this.
  13. WynnChairman

    WynnChairman Chairman of Wynn HERO

    Messages:
    3,452
    Likes Received:
    2,675
    Trophy Points:
    136
    Guild:
    Minecraft:
    for some reason a bunch of the commands kinda stop working for no reason, more specifically >g territorytrack and >g wartrack
    they just turn off without me touching them or anything
     
  14. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    There’s been issues with Discord servers (actually google cloud platform had them) for about the past 10 days or something, and because the bot was made to remove tracking entries when it detects failure to send messages (to avoid errors when someone makes the bot leave with tracking on), it automatically removed them.
    Sorry for this, but please just turn them on again when it happens, for now. I’ll try to fix them on my side when I can.
     
    WynnChairman likes this.
  15. WynnChairman

    WynnChairman Chairman of Wynn HERO

    Messages:
    3,452
    Likes Received:
    2,675
    Trophy Points:
    136
    Guild:
    Minecraft:
    oh ok i c
     
  16. Gozagal

    Gozagal Well-Known Adventurer

    Messages:
    5
    Likes Received:
    3
    Trophy Points:
    45
    Minecraft:
    It would be useful if we had a way to track guild members activity or just being notified when someone connect to Wynncraft.
     
  17. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    Hey, thanks for suggestion.

    To tell you the truth, I thought about it once, but I ended up not implementing those for public, because it would be too much of stalking, and because friend command/official stats page would be enough.
    Honestly, guild war tracking itself is the same in that sense, and I'm pretty sure not everyone likes being stalked and logged permanently 24/7. So far I haven't received any complaints about it, but just thought that implementing further stalking methods and publishing them would be too much, I hope you understand that.
     
  18. Fyr3_

    Fyr3_ Random Mage

    Messages:
    279
    Likes Received:
    113
    Trophy Points:
    72
    Guild:
    Minecraft:
    Is it possible to make a command to notify a person when a member in the guild has donated anything and/or has used guild emeralds (for wars)?

    Edit: For example, doing the command >g donations [guild] would be able to track every emerald a person has donated to the guild. Doing >g emerald [guild] would be able to track how many emeralds were used to defend a guild territory.
     
    Last edited: Aug 4, 2018
  19. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    Well, no, that would be impossible (as far as I know) with the current public API feature. Simply, there's no way to see or track how much emeralds a guild member has contributed to the guild.
    Also, because of the rate limit (250 reqs / 10 mins), I wouldn't be able to make such commands (in public bot) if it needs to access each guild's API page every once in a while.

    (Note: "contributed" field represents the amount of XP they have contributed, not amount of emeralds. e.g.: https://api.wynncraft.com/public_api.php?action=guildStats&command=UltimateXeons
    Afaik only your guild members can access the amount of emeralds contributed and used using /guild list/log.)
     
  20. motoki1

    motoki1 The Damage Calculation Scientist HERO

    Messages:
    3,344
    Likes Received:
    4,493
    Trophy Points:
    217
    Guild:
    Minecraft:
    v1.8.0 release : Finally, war leaderboards!

    General
    • New command ">g leaderboard", ">g playerleaderboard" : Shows guild/player leaderboard, finally. Please refer to in-command help (>g lb help, >g plb help) for more precise usage.
    • Territory list is now requested and processed first instead of online players list now (and improved logic a little bit), so that might either improve war logging or cause more bugs (or both).
    • The bot will now notify you when an unexpected error has occurred on command processing, so you no longer have to wait for the response awkwardly when it caused error inside.
    Guilds
    • Command input ">g [guild name]" is now a shortcut for ">g stats [guild name]".
    • Although guild names/tags are case sensitive, it can now search ignoring cases when no guilds matched with the input name first in case sensitive search.
     
    WynnChairman likes this.
Thread Status:
Not open for further replies.