Compare commits

...

3 Commits

Author SHA1 Message Date
757976c8f6 main: Remove Discord webhooks if they are not authenticated 2022-05-01 16:17:51 +02:00
48c8893ddf repo: Pin dependencies
This fixes an issue with slixmpp > 1.7.1
2022-05-01 16:17:17 +02:00
d1a1946b4b docs: Fix typo in the toml documentation 2022-04-27 18:56:21 +02:00
3 changed files with 19 additions and 7 deletions

View File

@ -21,7 +21,7 @@ The bridge can be configured via `config.toml` at either the current working dir
[general] [general]
jid = "discord.server.example" # JID of the server component jid = "discord.server.example" # JID of the server component
secret = "secret" # Component secret secret = "secret" # Component secret
server = "server.example # Address of the actual XMPP server server = "server.example" # Address of the actual XMPP server
port = 5869 # Component port port = 5869 # Component port
discord_token "...." # Token of your Discord bot discord_token "...." # Token of your Discord bot

View File

@ -9,10 +9,10 @@ setup(
license = "GPLc3", license = "GPLc3",
packages = find_packages(), packages = find_packages(),
install_requires = [ install_requires = [
"requests>=2.26.0", "requests==2.27.1",
"slixmpp>=1.7.1", "slixmpp==1.7.1",
"nextcord", "nextcord",
"toml>=0.10.2" "toml==0.10.2"
], ],
extra_require = { extra_require = {
"dev": [ "dev": [

View File

@ -206,6 +206,10 @@ class BridgeComponent(ComponentXMPP):
wh = None wh = None
for webhook in await dchannel.webhooks(): for webhook in await dchannel.webhooks():
if webhook.name == "discord-xmpp-bridge": if webhook.name == "discord-xmpp-bridge":
if not webhook.is_authenticated():
_logger.info("Webhook for %s has no token. Deleting and recreating" % muc)
await webhook.delete(reason="Webhook has no token. Will recreate")
else:
wh = webhook wh = webhook
break break
if not wh: if not wh:
@ -526,7 +530,15 @@ def main():
general["port"], general["port"],
general["discord_token"], general["discord_token"],
config) config)
for xep in [ "0030", "0199", "0045", "0084", "0153", "0054", "0060" ]: for xep in [
"0030",
"0199",
"0045",
"0084",
"0153",
"0054",
"0060"
]:
xmpp.register_plugin(f"xep_{xep}") xmpp.register_plugin(f"xep_{xep}")
logging.basicConfig(stream=sys.stdout, level=verbosity) logging.basicConfig(stream=sys.stdout, level=verbosity)