Add broadcast method
This commit is contained in:
parent
0c8b14c25d
commit
66ae28d589
|
@ -219,6 +219,7 @@ def timeline(bot, update, args = [10]):
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
# Streaming
|
# Streaming
|
||||||
|
|
||||||
mentionstreams = {}
|
mentionstreams = {}
|
||||||
|
|
||||||
def makeStream(bot, cid):
|
def makeStream(bot, cid):
|
||||||
|
@ -264,3 +265,9 @@ def restart(bot, update):
|
||||||
else:
|
else:
|
||||||
bottools.methods.unknown(bot, update)
|
bottools.methods.unknown(bot, update)
|
||||||
|
|
||||||
|
def broadcast(bot, update, args):
|
||||||
|
if bottools.methods.isadmin(update.message):
|
||||||
|
for u in dbtools.dbHelper().allUsers():
|
||||||
|
bot.sendMessage(chat_id = u, text = ' '.join(args))
|
||||||
|
else:
|
||||||
|
bottools.methods.unknown(bot, update)
|
||||||
|
|
|
@ -166,6 +166,11 @@ class dbObject:
|
||||||
for u in self.getAll():
|
for u in self.getAll():
|
||||||
yield u[0]
|
yield u[0]
|
||||||
|
|
||||||
|
def allUsers(self):
|
||||||
|
self.executeQuery("SELECT cid FROM tokens;")
|
||||||
|
for u in self.getAll():
|
||||||
|
yield u[0]
|
||||||
|
|
||||||
def addFish(self, cid):
|
def addFish(self, cid):
|
||||||
self.executeQuery("UPDATE tokens SET fish = fish + 1 WHERE cid = %i;" % int(cid))
|
self.executeQuery("UPDATE tokens SET fish = fish + 1 WHERE cid = %i;" % int(cid))
|
||||||
self.commit()
|
self.commit()
|
||||||
|
|
Loading…
Reference in a new issue