TenTalkBotDiscord Bot for OSRS CC Ten Talk
===== Bot Descriptions =====
Control scripts
start.sh - Starts bots individually or all at oncestop.sh - Stops bots individually or all at oncerestart.sh - Restarts bots individually or all at once
CCBot
cc_to_disc.py - Reads cc messages from latest.log and sends them to Discord on specified channelSupports @discord name@ pingsSupports #discord channel# pingsdisc_to_cc.py - Reads discord messages from specified channel and sends them to CCNOTE: Autotypers are bannable. Use at your own riskSupports @discord-user conversion to name in ccSupports #discord-channel conversion to name in ccSupports :emote: conversion to name in cckeep_alive.py - Prevents bot from being logged out and auto re-logs after 6 hour logNOTE: Autoclickers are bannable. Use at your own riskNote that there is no support to relog after the weekly update. You must manually restart Runelitemention.py - Turns @user@ into a proper Discord mentionmouse_pos.py - Use to find appropriate mouse locations during setup of keep_alive.pyccbot_logger.py - Logs all messages sent to the CC Clone bot with Discord IDPrevents people impersonating others nefariouslyccbot_commands.py - Allows !commands to be used in CCccbot_commands.cfg - Allows controlling which commands will work in CCcc_metrics.py - Pushes cc data such as logins and messages to Google Sheets
Discord commands
!commands - Shows a list of available commandsSupports CCBot use!discord - Friendly link to the Discord serverSupports CCBot use!givefriend <@User> <RSN> - Give user Clan Friend rank and add them to the Clan SpreadsheetIf the user is already a clan member, it removes member roleRequires manage roles permissions!giverank <@User> <RSN> - Give user Member rank and add them to the clan spreadsheetIf the user is already a clan friend, it removes friend roleRequires manage roles permissions!hello - Hello! Use this to confirm the bot is connected to the serverSupports CCBot use!info - Shows whetever is set by !info_setSupports CCBot use!info_set <cc/disc> <"message"> - Set a pre-recorded !info message; supports seperate messages for CC and DiscRequires manage messages permissions!motd - Shows whetever is set by !motd_setSupports CCBot use!motd_set <cc/disc> <"message"> - Set a pre-recorded !motd message; supports seperate messages for CC and DiscRequires manage messages permissions!move <#Channel> <message ids> - Moves the specified message IDs to the #Channel specifiedRequires manage_messages permissions!online - Shows RSNs of all players currently online in CC!poll <mins> <question> <opt1> .. <opt 8>Create a poll that lasts for <mins> minutesUp to 8 available optionsUse reactions to answer!poll_cancel <number>Cancel a specific poll numberUsers are able to only cancel their own pollsMods/Admins can calcel any poll!raids - Gives a link to the Level 3 Raids Discord serverSupports CCBot use!rankup.py <@User> - Refresh user stats in Clan Spreadsheet and give new rank to member!register <Twitch Name> - Register Twitch Name to the Live bot; 1 Twitch ID per Discord user!reminder - Drink Up!Supports CCBot use!signup - Tells mods you have passed probation and want to join sotwSupports CCBot use!sotw - Shows whetever is set by !sotw_setSupports CCBot use!sotw_set <cc/disc> <"message"> - Set a pre-recorded !sotw message; supports seperate messages for CC and DiscRequires manage messages permissions!stats <rsn> - Shows stats for a specified RSN. Use quotes if RSN contains spaces "Eg RSN"!sotw - shows a predefined message in sotw.msgSupports CCBot use!unregister <Twitch Name> - Unregister Twitch Name from the Live bot; Mods can unregister anyone, users can only unregister themselves!welcome_set <"message"> - Set a pre-recorded welcome messageRequires manage messages permissions
Other
disc_commands.cfg - Allows controlling what is shown by !commands in Discordlive.py - Send notifications to specified channel when Discord members go live on Twitchreaction_roles.py - Gives users roles when reacting to a specified messagewelcome.py - Shows a pre-recorded message when a new user joins the Discord
Runelite Plugin
There are two java files that comprise a custom Runelite plugin, Chat Logger Extended.
===== Setup Instructions =====
To run this bot you will need 1 headless linux server and 1 headed pc, any OS.The OS for the headed PC must be capable of running Runelite.Debian is recommended for the Linux server.If the headed PC is running Linux, it can double as the headless linux server.You will not be able to use the headed PC once scripts are running, they will take over your mouse and keyboard.
Before running any programs, install python3 and the following pip packages onto both computers:
discorddiscord.pygoogle-authgoogle-auth-oauthlibgspreadmatplotlibnumpyoauth2clientoauthlibOSRSBytesPillowPyAutoGUIpycryptoPyGetWindowpython-dotenvpython-imagesearchPyTweeningtwitch-pythontyping-extensions
Create your .env file
Create a file called .env using this template:TOKEN=123hjk123hjk123hjk123hjk123hjk123hjk123hkjcclog=C:\\Users\\Admin\\.runelite\\chatlogs\\friends\\latest.logsheet=123ghj123ghj123gjh543ghj6iuy654iuy654iuy654password=hunter2ironman=<:ironman:4356734645643564536>hcim=<:HCIM:4356456435643653456>uim=<:UIM:43563456435634564356>hp10=<:10hp:124234235423453425324>skiller=<:skiller:3245324523453425>f2p=<:f2p:34532452345234532>maxed=<:maxed:4563456345643563456>champ=<"champ:7345897234895>channel=12321312312312332123botchan=798437598347598347859reactchan=435984738298573849589342reactmsg=39045830492589034leader=32904583904589034council=89034859034850345welcome_chan=348093845908390534twitch_client=fio34ni9fn93infg08543n0gtwitch_secret=mi09435jng03809g3480gtwitch_channel=4390589034859034234235Populate the .env file as described:TOKEN is your Discord Bot Tokencclog is the full filepath of the runelite cc log, latest.logsheet is the unique id of the google sheet storing your member datapassword is the osrs password for the account running discord_to_cc/cc_to_discordironman is the emote id of an ironman helm in your discord serverhcim is the emote id of a hcim helm in your discord serveruim is the emote id of a uim helm in your discord serverhp10 is the emote id of a 10HP logo in your discord serverskiller is the emote id of a skiller logo in your discord serverf2p is the emote id of a f2p logo in your discord servermaxed is the emote id of a maxed logo in your discord serverchamp is the emote id of a champ cape logo in your discord serverchannel is the discord channel id where ccbot will runbotchan is channel that only bots can access to pass data between themreactchan is the channel where reaction_roles will runreactmsg is the message in reactchan where reaction_roles will runleader is the UID of the leader rolecouncil is the UID of the council rolewelcome_chan is the channel where new member notifications are showntwitch_client is your Twitch API client IDtwitch_secret is your Twitch API secret IDtwitch_channel is the UID of the discord channel where Twitch notifications will be sent
Additional setup for the headed PC
Open RuneliteInstall the plugin "Chat Logger" and enable itLogin in to an accountRecommend using a burner account and connecting pc to a VPN, bot ban IS possibleNote that the burner must have a minimum total level of 150 to join a CCJoin the CC you desire to sync between Discord and in-game CCPut runelite in the top-left of your screenNote that the keep_alive.py and disc_to_cc.py are designed for a 4K screenIf running a different resolution you must change the moveTo() command locationsUse mouse_pos.py to calibrate thisBy default Chat Logger does not support login/logout messages, but many CCBot features require thisIn order to support this you must compile Runelite from source and inject the 2 .java files as a custom pluginAfter Runelite is compiled, just turn on Chat Logger ExtendedCheckout this guide on Runelite plugin development:https://www.osrsbox.com/blog/2018/08/10/writing-runelite-plugins-part-1-building/https://www.osrsbox.com/blog/2018/08/12/writing-runelite-plugins-part-2-structure/https://www.osrsbox.com/blog/2018/08/18/writing-runelite-plugins-part-3-config/https://www.osrsbox.com/blog/2019/01/17/writing-runelite-plugins-part-4-overlays/
Additional setup for the headless linux server
Perform the steps under the heading "Google Drive API and Service Account" on https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.htmlPut the client_secret.json in the same folder as the git repoAdd cc_metrics to your crontab to run daily
Clone the git repo. Recommend using the master branch