Olyno / SkEmail

Skript addon to send emails
8 stars 3 forks source link

Can't recover mails #52

Closed Le-Thom closed 3 years ago

Le-Thom commented 3 years ago

<--! To make sure you have all the keys in hand to be able to help you, I invite you to fill out the form as proposed below, including information about your server. Are you ready to go? Let's do it! (just delete wrong informations) -->

Versions:

I'm using a minecraft server 1.16.1 (Paper-117) I'm using skript version 2.5.1 I'm using SkEmail version 1.7 About the issue:

I got a [java|skript] error:


[Skript] Severe Error:

Something went horribly wrong with Skript.
This issue is NOT your fault! You probably can't fix it yourself, either.
It looks like you are using some plugin(s) that alter how Skript works (addons).
Here is full list of them:
skRayFall v1.9.20 (https://sk.rayfall.net/) TuSKe v1.8.2-Pikachu-Patch-3 (github.com/Tuke-Nuke/TuSKe) skUtilities v0.9.2 (https://tim740.github.io/) SkQuery v3.6.5 Skellett v1.9.9 (https://forums.skunity.com/resources/skellett.24/) SkEmail v1.7 
We could not identify which of those are specially related, so this might also be Skript issue.
You should try disabling those plugins one by one, trying to find which one causes it.
If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
In that case, you will be given instruction on how should you report it.
On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
Only if the author tells you to do so, report it to Skript's issue tracker.

Stack trace:
java.lang.NullPointerException
    at com.olyno.skemail.expressions.ExprLastEmails.get(ExprLastEmails.java:95)
    at com.olyno.skemail.expressions.ExprLastEmails.get(ExprLastEmails.java:21)
    at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:100)
    at ch.njol.skript.effects.EffChange.execute(EffChange.java:276)
    at ch.njol.skript.lang.Effect.run(Effect.java:51)
    at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:60)
    at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:88)
    at ch.njol.skript.lang.Trigger.execute(Trigger.java:56)
    at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:291)
    at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:250)
    at ch.njol.skript.command.Commands.handleCommand(Commands.java:248)
    at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:165)
    at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:37)
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607)
    at net.minecraft.server.v1_16_R1.PlayerConnection.handleCommand(PlayerConnection.java:1904)
    at net.minecraft.server.v1_16_R1.PlayerConnection.a(PlayerConnection.java:1723)
    at net.minecraft.server.v1_16_R1.PacketPlayInChat.a(PacketPlayInChat.java:47)
    at net.minecraft.server.v1_16_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
    at net.minecraft.server.v1_16_R1.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23)
    at net.minecraft.server.v1_16_R1.TickTask.run(SourceFile:18)
    at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136)
    at net.minecraft.server.v1_16_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
    at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109)
    at net.minecraft.server.v1_16_R1.MinecraftServer.aZ(MinecraftServer.java:1136)
    at net.minecraft.server.v1_16_R1.MinecraftServer.executeNext(MinecraftServer.java:1129)
    at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119)
    at net.minecraft.server.v1_16_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1090)
    at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:1004)
    at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177)
    at java.lang.Thread.run(Thread.java:748)

Version Information:
  Skript: 2.5.1 (latest)
    Flavor: skriptlang-github
    Date: 2020-10-22
  Bukkit: 1.16.1-R0.1-SNAPSHOT
  Minecraft: 1.16.1
  Java: 1.8.0_202 (Java HotSpot(TM) 64-Bit Server VM 25.202-b08)
  OS: Linux amd64 4.19.0-10-amd64

Server platform: Paper

Current node: null
Current item: set {_mails::*}(as java.lang.Object) to last emails
Current trigger: command /check_mails (simple event) (mail.sk, line -1)

Thread: Server thread

Language: english
Link parse mode: DISABLED

End of Error.

My code is:

options:
    prefix: §8[§6Mail§8]

command /testmail <text>:
    trigger:
        set {_mail} to arg-1
        if {_mail} do not contain "@":
            stop
        set {mail.%player%} to {_mail}
        add player to {mail.newsletter::*}
        make new mail:
            set author of email to "/mail/"
            set receiver of email to "%{_mail}%"
            set object of email to "Inscription à la Newsletter de LeJEU"
            set body of email to "Bonjour %player%, Merci de vous être inscrit à la liste de diffusion des nouveautés du serveur :D Vous recevrez toutes les nouveautés et informations du serveur à l'adresse mail suivante : %{_mail}%. %nl%%nl%Si vous souhaitez vous désinscrire veuillez taper la commande "
        login to roundcube service from mail "/mail/" and password "/password/"
        send last mail created
        send "{@prefix} §aVotre email à été enregistré pour recevoir les nouveautés ! Allez vite check vos mails :D" to player

command /check_mails:
    permission: console
    trigger:
        set {_mails::*} to last 2 mails
        loop {_mails::*}:
            set {_author} to the author of loop-value
            set {_content} to body of loop-value
            loop {mail.newsletter::*}:
                if {_author} is {mail.%loop-value-2%}:
                    if {_content} contain "STOP" or "stop":
                        set {_mail} to {mail.%loop-value-2%}
                        make new mail:
                            set author of email to "/mail/"
                            set receiver of email to "%{_mail}%"
                            set object of email to "Désinscription de la Newsletter"
                            set body of email to "Bonjour %loop-value-2%, ce mail vous confirme votre désinscription au service de Newsletter du serveur ! A très bientôt :D"
                        login to roundcube service from mail "/mail/" and password "/password/"
                        send last mail created
                        remove loop-value-2 from {mail.newsletter::*}
                        send "EMAIL SENDED" to console

I think the problem comes from the expression "last 2 mails"... It's seems that skript can't save the mails in the list

issue-label-bot[bot] commented 3 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.71. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Olyno commented 3 years ago

Seems like you never login in your account. So it's logic to get this error. Please use the login effect before trying to use SkEmail

Le-Thom commented 3 years ago

Ok thanks but now this is not an error but skript can't recover the author of the mails...

image

i didn't change the versions and this is my new code:

options:
    prefix: §8[§6Mail§8]

command /testmail <text>:
    trigger:
        set {_mail} to arg-1
        if {_mail} do not contain "@":
            stop
        set {mail.%player%} to {_mail}
        add player to {mail.newsletter::*}
        make new mail:
            set author of email to "noreply@lethom.xyz"
            set receiver of email to "%{_mail}%"
            set object of email to "Inscription à la Newsletter de LeJEU"
            set body of email to "Bonjour %player%, Merci de vous être inscrit à la liste de diffusion des nouveautés du serveur :D Vous recevrez toutes les nouveautés et informations du serveur à l'adresse mail suivante : %{_mail}%. %nl%%nl%Si vous souhaitez vous désinscrire veuillez répondre à ce mail."
        login to roundcube service from mail "/mail/" and password "/password/"
        send last mail created
        send "{@prefix} §aVotre email à été enregistré pour recevoir les nouveautés ! Allez vite check vos mails :D" to player
        disconnect "/mail/" from all connected mails

command /check_mails:
    permission: console
    trigger:
        login to roundcube service from mail "/mail/" and password "/password/"
        send "Connected" to console
        set {_mails::*} to last 1 mails
        loop {_mails::*}:
            set {_mail} to loop-value
            set {_author} to the author of loop-value
            send "Mail de %{_author}%" to console
            loop {mail.newsletter::*}:
                if {_author} is {mail.%loop-value-2%}:
                    set {_mail} to {mail.%loop-value-2%}
                    make new mail:
                        set author of email to "noreply@lethom.xyz"
                        set receiver of email to "%{_mail}%"
                        set object of email to "Désinscription de la Newsletter"
                        set body of email to "Bonjour %loop-value-2%, ce mail vous confirme votre désinscription au service de Newsletter du serveur ! A très bientôt :D"
                    send last mail created
                    remove loop-value-2 from {mail.newsletter::*}
                    send "EMAIL SENDED" to console
        disconnect "/mail/" from all connected mails
Olyno commented 3 years ago

Try to use the login effect in the on load or on skript load event and try the on email connected event to check if your account is correctly connected

Olyno commented 3 years ago

Closed due to inactivity