generated from Nemesis/Exemple
module invidious
This commit is contained in:
parent
9f4015421a
commit
15d267945b
2 changed files with 22 additions and 3 deletions
|
@ -5,8 +5,8 @@ server = https://instance.tld
|
|||
admin = @mxid:intance.tld
|
||||
|
||||
[MOD]
|
||||
# liste = roll,quote,biere,stats,liste,horloge,carte,card,cristal,welcome,salut,jdr,gens,va,salon,kick,mails,titre
|
||||
liste = roll,quote,biere,stats,liste,horloge,carte,card,cristal,welcome,salut,jdr,gens,va,salon,kick,mails,titre
|
||||
# liste = roll,quote,biere,stats,liste,horloge,carte,card,cristal,welcome,salut,jdr,gens,va,salon,kick,mails,titre,invidious
|
||||
liste = roll,quote,biere,stats,liste,horloge,carte,card,cristal,welcome,salut,jdr,gens,va,salon,kick,mails,titre,invidious
|
||||
|
||||
[MAIL]
|
||||
malt = 0
|
||||
|
|
21
asmodee.py
21
asmodee.py
|
@ -2056,6 +2056,20 @@ def titre(room, event): # cherche le titre d'une page
|
|||
msg(room,"URL invalide",event['sender'])
|
||||
|
||||
|
||||
def invidious(room, event): # convertit un lien youtube en lien invidious
|
||||
global modules
|
||||
try:
|
||||
rmod = modules[room.room_id, 'invidious']
|
||||
except:
|
||||
modules[room.room_id, 'invidious'] = False
|
||||
if (modules[room.room_id, 'invidious']):
|
||||
url = event['content']['body']
|
||||
try:
|
||||
res = re.sub(r"^.*\?v=([^& ]*).*$", r"\1", url)
|
||||
msg(room,str("Une alternative à youtube pour cette video : https://invidio.us/watch?v=" + res),event['sender'])
|
||||
except:
|
||||
msg(room,"URL invalide",event['sender'])
|
||||
|
||||
|
||||
def main():
|
||||
global USERNAME
|
||||
|
@ -2064,7 +2078,7 @@ def main():
|
|||
USERNAME = "" # Bot's username
|
||||
PASSWORD = "" # Bot's password
|
||||
SERVER = "" # Matrix server URL
|
||||
mods = ["roll", "quote", "biere", "stats", "liste", "horloge", "carte", "card", "cristal", "welcome", "salut", "jdr", "gens", "va", "salon", "kick", "mails", "titre"]
|
||||
mods = ["roll", "quote", "biere", "stats", "liste", "horloge", "carte", "card", "cristal", "welcome", "salut", "jdr", "gens", "va", "salon", "kick", "mails", "titre", "invidious"]
|
||||
global admins
|
||||
if ('AUTH' in config):
|
||||
USERNAME = config['AUTH']['username'] # Bot's username
|
||||
|
@ -2220,6 +2234,11 @@ def main():
|
|||
titre_handler = MCommandHandler("titre", titre)
|
||||
bot.add_handler(titre_handler)
|
||||
|
||||
# Invidious
|
||||
if ('invidious' in liste_mod):
|
||||
invidious_handler = MRegexHandler("youtu", invidious)
|
||||
bot.add_handler(invidious_handler)
|
||||
|
||||
# Definition des moderateurs
|
||||
modos_read()
|
||||
modos_handler = MCommandHandler("modo", modo)
|
||||
|
|
Loading…
Reference in a new issue