Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright (c) Mathias Kaerlev 2013.
- #
- # This file is part of cuwo.
- #
- # cuwo is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # cuwo is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with cuwo. If not, see <http://www.gnu.org/licenses/>.
- """
- Rotating auto announcements
- """
- from cuwo.script import ServerScript
- from twisted.internet import task, reactor
- import random
- import sys
- class Announcer(ServerScript):
- def on_load(self):
- self.auto_announce_timer = task.LoopingCall(self.auto_announce)
- self.auto_announce_timer.start(300, True)
- def auto_announce(self):
- message = getattr(self.server.config, 'announcement', '"Welcome to the server!"')
- self.server.send_chat(message)
- print message
- def get_class():
- return Announcer
Advertisement
Add Comment
Please, Sign In to add comment