Package: miniirc-discord
miniirc_discordA wrapper for miniirc (GitHub,GitLab) to allow bots or clients made in
miniirc to connect to (proprietary)Discordservers viadiscord.pywith
minimal code changes.How to useTo use miniirc_discord, you already need to know how to use miniirc (GitHub,GitLab). Instead of creating aminiirc.IRCobject, however, you need to
useminiirc_discord.Discord. This is very similar, however has some
differences:miniirc_discord.Discordobjects are created withminiirc_discord.Discord('TOKEN').There is astateless_modekeyword argument.Thediscord_clientattribute returns an instance ofdiscord.Client, orNoneif stateless_mode is enabled.There is aget_server_count()method which returns the number of guilds
the bot is in.Channels will start in#if they are public and are currently just a channel
ID.Some formatting from IRC to Discord should be translated nicely, however
more complex codes and formatting from Discord to IRC are currently not.Your bot will need to be able to request the "message content" intent for
miniirc_discord to work properly.Stateless modeThestateless_modekeyword argument will instruct discord.py to disable the
user cache and any intents not required by miniirc_discord. This should be
enabled if you are not usingdiscord_clientto cut back on memory and
bandwidth usage.Since miniirc_discord 0.6.0, the stateless_mode keyword argument isTrueby
default.ExampleTOKEN=os.environ['DISCORD_TOKEN']irc=miniirc_discord.Discord(TOKEN)channel=irc.discord_client.get_channel(channel_id)# Error!# Disabling stateless mode will add a "discord_client" attributeirc=miniirc_discord.Discord(TOKEN,stateless_mode=False)channel=irc.discord_client.get_channel(channel_id)# No errorSupported commandsPRIVMSGPRIVMSGoperates like you'd expect and IRC formatting codes are converted to
markdown. You can use the+draft/replyIRCv3 tag to reply to a message.CTCP ACTION(irc.me())This works similarly toPRIVMSG, except the CTCP ACTION is also converted to
a Discord/me.NOTICENOTICEs are converted into embeds by miniirc_discord. To set an embed title,
you can add a bold line to the start of the embed:irc.notice(channel,'\x02Embed title\x02\nEmbed content')You can add anIRC colour codeto the start of the line to set the embed colour:# Green embedirc.notice(channel,'\x033\x02Embed title\x02\x03\nEmbed content')# Light blue embedirc.notice(channel,'\x0312\x02Embed title\x02\x03\nEmbed content')Older versions of miniirc_discord had a non-standard IRCv3 tag to set the embed
title. This is still supported, however you should switch to the above syntax
when possible.TAGMSGYou can add reactions to messages using the+draft/reactmessage tag.Example:@irc.Handler('PRIVMSG',colon=False,ircv3=True)defhandle_privmsg(irc,hostmask,tags,args):ifargs[1]=='$react':irc.send('TAGMSG',args[0],tags={'+draft/reply':tags.get('msgid'),'+draft/react':'🆗️'})AWAYAWAYwill set the bot's "Playing" text. If you
want to change the prefix to something else, you can set the non-standard IRCv3
client tag+discordapp.com/typeto (Playing,Streaming,Listening toorWatching). The+discordapp.com/statustag can be set to'online','idle','dnd'or'invisible'.Installation and setting upYou can installminiirc_discordwithpip. On Linux-based systems, you would
dosudo pip3 install miniirc_discord. Version numbers should follow SemVer
since 0.4.0 and are no longer in sync withminiirc.Getting a bot tokenTo get a Discord bot token and invite link, seethis guide. Make sure you
enable the message content intent in the bot settings page.