Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:59:29+00:00 2026-06-15T10:59:29+00:00

I have a basic IRC bot that looks something like this (see below), what

  • 0

I have a basic IRC bot that looks something like this (see below), what I would like to do is use something like the _5_mins function to be called every 5 mins with a LoopingCall

import sys
import re
from twisted.internet import reactor, task, defer, protocol
from twisted.python import log
from twisted.words.protocols import irc
from twisted.application import internet, service
import time

HOST, PORT = 'irc.freenode.net', 6667

class IrcProtocol(irc.IRCClient):
    nickname = 'BOTSNAME'
    password = 'NICKPASSWORD'
    timeout = 600.0

    def signedOn(self):
        pMess = "IDENTIFY %s" % self.password
        self.msg("NickServ",pMess)
        time.sleep(10)
        for channel in self.factory.channels:
            self.join(channel)

    def _5_mins(self):
        self.msg(self.factory.channels[0],"5 minutes have elapsed")

class IrcFactory(protocol.ReconnectingClientFactory):
    channels = ['#BOTCHANNEL']
    protocol = IrcProtocol

if __name__ == '__main__':
    reactor.connectTCP(HOST, PORT, IrcFactory())
    log.startLogging(sys.stdout)
    reactor.run()

elif __name__ == '__builtin__':
    application = service.Application('IrcBot')
    ircService = internet.TCPClient(HOST, PORT, IrcFactory())
    ircService.setServiceParent(application)

How do I alter the signedOn function work with the task.LoopingCall function or is there a better way?

EDIT: I was really close to a solution, the following is what I have gone with

def signedOn(self):
    pMess = "IDENTIFY %s" % self.password
    self.msg("NickServ",pMess)
    time.sleep(10)
    for channel in self.factory.channels:
        self.join(channel)
    lc = task.LoopingCall(self._5_mins)
    lc.start(self.timeout)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:59:30+00:00Added an answer on June 15, 2026 at 10:59 am
    def signedOn(self):
        pMess = "IDENTIFY %s" % self.password
        self.msg("NickServ",pMess)
        time.sleep(10)
        for channel in self.factory.channels:
            self.join(channel)
        lc = task.LoopingCall(self._5_mins)
        lc.start(self.timeout)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have basic code that looks like this: while(inputfileStream.good()) { for(int i = 0;i<levels;i++)
I have basic function that prints network errors based on enum NetworkError. that looks
I need help writing a basic IRC bot that just connects to a channel..
I have basic issue that i don't understand, we use HEAT to consume directory
I have basic CSS experienced so I would like to know how can I
I have a basic web service that returns the following object as JSON: public
I have basic stored procedure that performs a full text search against 3 columns
I have basic idea about running PHP in different configurations like mod_php, cgi, FastCGI,
I have basic JavaScript code that needs to tell how many names out of
It seems like most of the messaging systems I've looked at have basic, if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.