Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am writing an IRC bot that needs to advertise something every few minutes to the channel. I made an attempt with the Timer but it's so messy I can't paste it here because it will be unreadable, I can post the entire file's code to pastebin though.

What needs to be looped/timed to send every 5 minutes to the channel:

public static void ChannelAdvertise(object sender, IrcEventArgs e)
{
    string advertiseStream = "Live right now: ";
    foreach (Monitor stream in streams)
    {
        if (stream.streamOnline)
        {
            advertiseStream += (char)3 + "03" + stream.nick + 
                (char)15 + " - " + stream.weblink() + " ";
        }
    }
    irc.SendMessage(SendType.Message, e.Data.Channel, 
        advertiseString);
}


The output of that is Live right now: streamname - streamlink
e.g [21:40] <el> Live right now: joinDOTA with Tobi Wan - http://www.own3d.tv/live/10588

Just that piece of code/output needs to be sent to the channel every 10 minutes. Any help/pointers would be appreciated. Snippet from my attempt, but I get "No overload for method 'ChannelAdvertise' takes 0 arguments. I don't know how to do this, but it's my attempt: pastebin.com/wEqWceFw
Posted
Updated 18-Dec-11 9:15am
v5
Comments
Sergey Alexandrovich Kryukov 18-Dec-11 16:00pm    
To me, your whole project looks like a pure evil.
--SA

1 solution

The problem is not in the code you posted, but where it is invoked. Somewhere either you directly or some part of the framework calls the function you mentioned with no parameters. The definition of said function takes two parameters none of which you nor the postulated framework provided.

Regards,

Manfred
 
Share this answer
 
v3
Comments
Espen Harlinn 30-Dec-11 9:42am    
5'ed!
Manfred Rudolf Bihy 30-Dec-11 10:39am    
Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900