Avorion

Avorion

Ei tarpeeksi arvosteluja
Avorion Announcer
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Mods: Mod
Tiedostokoko
Julkaistu
Päivitetty
596.491 KB
23.3.2020 klo 2.50
13.9.2021 klo 13.05
16 muutosilmoitusta ( näytä )

Tilaa ladataksesi
Avorion Announcer

1 kokoelmassa, tekijä Rinart73
Rinart73's Mods
39 luomusta
Kuvaus
Avorion: 0.31 - 2.0
A mod + bot that connect Avorion server with a Discord server.

NOTE: This mod will be updated to the stable versions only. I'm not planning to support Beta-versions since they come out very often and I don't have the time to check and update mods every time.

You can support me on Patreon[www.patreon.com].

Features:
  • Displays server status and player count in the bot status.
  • Allows to specify 3 Discord channels for the following purposes:
    • chat - Two-way communication with Avorion global chat.
    • events - Displays event messages (if you have some cool modded events) that can be sent via mod API.
    • admin - Used to notify admins about server hangs and to display important custom messages (such as bug/player reports) via mod API.
  • Allows to execute server RCON commands (ban, kick, mute etc.) via Discord commands and via mod API.

Installation:
  1. Install Python 3.7.3+[www.python.org]
  2. Make sure that you have Python Pip 19.0.3+ installed. If you don't, install it[pip.pypa.io].
  3. Install psutil 5.6.3+
    pip install psutil
  4. Install Discord.py 1.2.5+
    pip install -U discord.py
  5. Install MCRcon
    pip install mcrcon
  6. Go to the Discord Developer Portal[discordapp.com], log in, press "New Application" and enter your bot name (e.g "My Server Bot")
  7. Go to the "Bot" tab, press "Add Bot" button. Then press "Copy" near the "Token" label to get a secret bot token. Save it somewhere, we'll need it later.
  8. Now go to the "OAuth2" tab and select the "bot" checkbox in the "scopes". This will generate an URL, that you should paste in your browser address box.
  9. In the new page select a server where you want to add the bot.
  10. Add this mod to your server[avorion.gamepedia.com]. Launch the server once to make it download the mod into the "workshop/content/445220/2032319866" folder.
  11. Open the "workshop/content/445220/2032319866" folder and launch the bot file "avorion-announcer.py" via Python 3.
  12. Since it's a first launch, the bot will ask for:
    1. A bot token (the one you saved)
    2. An absolute path to your galaxy directory
    3. A server process name
    4. A bot command prefix - this is how you'll start all your Discord bot requests
    5. RCON password - if you set it in the server.ini, this will enable RCON
  13. After a few seconds the bot will boot up.
  14. Use "[botprefix] setchannel [chat|events|admin]" command to assign channels.
  15. Use "[botprefix] help" to get list of all available commands.

API for Modders:
local Announcer = include("avorionannouncer") -- namespace ModNamespace ModNamespace = {} function ModNamespace.initialize() -- subscribe to a message event Galaxy():registerCallback("onAnnouncerMessage", "onAnnouncerMessage") -- simulate someone sending a chat message Announcer.sendMessage("chat", {"PlayerName", "ChatMessage"}) -- post in the events channel Announcer.sendMessage("events", {"**BoldEventTitle**", "@everyone - EventDescription!"}) -- post in the admin channel Announcer.sendMessage("admin", {"MessageTitle", "MessageDescription"}) -- execute RCON command Announcer.sendMessage("server", {"execute", '/kick "John Smith" "Reason: AFK"'}) end function ModNamespace.onAnnouncerMessage(args) if args[1] == "chat" then print("Chat message, player:", args[2], "message:", args[3]) elseif args[1] == "server" then print("Server made some request:", args[2], args[3]) elseif args[1] == "custom" then print("Custom command for some mod:", args[2], args[3]) if string.lower(args[2]) == "startevent" then ModNamespace.startModdedEvent(args[3]) end end end

Bug reporting:
  1. Tell your game version and list of mods you have activated.
  2. Give an instruction on how to reproduce a bug, step by step.
  3. Use Pastebin[pastebin.com] to attach links to your client and server logs.
    Client logs: C:UsersYourProfileNameAppDataRoamingAvorion
    Server logs: C:UsersYourProfileNameAppDataRoamingAvoriongalaxiesGalaxyName
  4. Make a screenshot if problem can be seen visually.

Config files locations:
Server:
  • Mod config - "AppData/Roaming/Avorion/galaxies/(GalaxyName)/moddata/AvorionAnnouncer.lua"
  • Bot config - "AppData/Roaming/Avorion/galaxies/(GalaxyName)/workshop/2032319866/settings.json"
27 kommenttia
David 27.8. klo 22.28 
Hi, every time i try to set the channel type i have the same error : es

!announcer setchannel [admin]

Something went wrong :/

i don't understand the problem
Rinart73  [tekijä] 4.5. klo 3.41 
OriginalLordDrow, aw thank you :)
WhiskerstheClockworkCat 3.5. klo 15.58 
Thanks for developing this, Rinart. You are a legend. brother.
Kein bOck 20.3.2023 klo 2.48 
Net.Core 5,6,7 are all stable!
It is also possible to do this with PERL.

For Net and Perl there are Discord-projects on GIT-hub that work.
YouTube.com/StoneLegion 16.2.2023 klo 5.08 
Is there an alternative like C# or anything but Phyton?
Kein bOck 2.2.2023 klo 0.12 
I'ts ok.
In my experience, phyton is not stable enough. Every update brings new problems with modules that no longer work.
Rinart73  [tekijä] 27.1.2023 klo 11.01 
Kein bOck, C# struggled with Linux for a while. Sure there is Mono, but still, it's an additional hassle to use a compiled language for a cross-platform solution, while I needed something that is quick to develop and works ok. Perl is not better than Python. Python is more popular and actually has a proper Discord library unlike Perl.
Kein bOck 14.1.2023 klo 19.06 
Perl or C# core
Rinart73  [tekijä] 3.1.2023 klo 10.34 
Kein bOck, well I needed some tool to make the Discord bot because it's not possible to do from Avorion itself. I had to choose between Python or NodeJS. If you think you can achieve a better result - feel free to.
Kein bOck 26.12.2022 klo 6.06 
Worst concept with Python!
:steamthumbsdown: