A discord.py bot for the TLC server
stringlapse / tlcbot Goto Github PK
View Code? Open in Web Editor NEWA discord.py bot for the TLC server
License: Do What The F*ck You Want To Public License
A discord.py bot for the TLC server
License: Do What The F*ck You Want To Public License
random.randrange(a, b)
, it appears a
is inclusive and b
is exclusive meaning each component should be picked with random.randrange(0, 256)
.(128 203 187)
and we pick the RGB components out) and pass it on to the color API or determine the format the user is attempting to use (ex: user inputs #12ad3
and we notice they're trying to use hex) and show them an example of how to use it.User should be able to type ";unlink all" to be able to get rid of all their social media. Easiest way is to just delete their db row.
So far socialmedia is only grabbed from #finished-art-โจ. This can be solved by .env'ing a "megastring" and having a check to see if the channel id of a sent message is in that string. Do this for #art-practice #character-design #drawthisinyourstyle #art-for-events and #the-glowup
This message will be sent via a command and will give people cookies if they react to it with cookie emoji (only once). There will be an end date to the message however and if people react after that end date then will not get cookies.
Have the bot able to recreate the "audit log" in a mod only chat. Displayed will be any "major changes" made like kicks, bans, mutes, the creation or deletion of channels, deletion of messages, creation or deletion of roles, etc. Your best bet would be to look at a server you moderate's audit log and see what types of actions are recorded under that. Make sure you also consult Brett as to what should be shown and not shown with that bot.
Options
probably other commands too
Couldn't get a single command working completely right. What we know so far:
bumpYes
is writing user IDs to the database with an exclamation point preceding them. See screenshot at end of issue.givecookie
acts right but doesn't award a cookie. No errors.balance
always says you have 0 cookies. No errors.leaderboard
tries to read the incorrectly stored user IDs stored by bumpYes
so we can't test it properly. Also see that screenshot.While you're in there it might not be a bad idea to add bal
as an alias for balance
and baltop
as an alias for leaderboard
.
Good luck
Reactions would probably be nicer but we can do ;leaderboard [page]
if needed
Should be able to just swap name
for display_name
https://discordpy.readthedocs.io/en/latest/api.html#discord.User.display_name
This can be accomplished by checking to see if the channels already exist (probably the better option) or deleting and recreating them every time
At the bottom of the message have a "your rank is #x". Also have the user be able to react to navigate through different pages of the leaderboard.
Lets just hope nobody discovers this
I had no idea we had a single embed color we were going with
yoink the code from prompt or something
Currently there is a separate table that stores a user's balance (the amount of cookies they have) called econ. Econ was created before we had a specific user's table, which was added when the social media cog was created. To reduce clutter / maintain consistency we should eventually store balance in the users table and get rid of econ, but it has been something I put on hold as that requires a lot of code to be changed.
We're printing things to the console that might be useful to log to a file with timestamps
Ignoring exception in on_message
Traceback (most recent call last):
File "/home/ryder/tlcbot/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "/home/ryder/tlcbot/bin/tlcbot/cogs/cookies.py", line 214, in on_message
await self.createBal(message.channel, member.id)
AttributeError: 'NoneType' object has no attribute 'id'
Ignoring exception in on_member_update
Traceback (most recent call last):
File "/home/ryder/tlcbot/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "/home/ryder/tlcbot/bin/tlcbot/cogs/socialmedia.py", line 176, in on_member_update
channel = await after.create_dm()
File "/home/ryder/tlcbot/lib/python3.8/site-packages/discord/user.py", line 715, in create_dm
data = await state.http.start_private_message(self.id)
File "/home/ryder/tlcbot/lib/python3.8/site-packages/discord/http.py", line 245, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50007): Cannot send messages to this user
Create a Secret Santa cog to help aid, as Keri suggested, a version of art secret santa. I am guessing you will have to make a new table in the db to save users and requests, as well as some way to randomly match users who requested with each other.
Excerpt from Brett's message:
ok I just tested the social media poster, it worked good and posted the tweet as it needed.
-The timer to create the message should be about twice as long, sometimes we mods get writer's block for a minute. There shouldn't be a big rush but I am glad it times out eventually.
-When there is an error, the bot needs to show the error for like 15 seconds and then delete the message so it doesn't clog the channel. I did this process and it created 10 extra messages in the channel to post one tweet.
-What I would like is once the tweet has been sent, take the twitter reaction off the post. If someone is adamant to search for the bird emoji to use it, then they should get a warning message, but if we remove all the birds, it will remove the temptation to use it again.
Starboards as I am sure you know copy a message that has been reacted to, usually after getting 3+ :star:
emojis, and sends that copy to a specific starboard channel. Here's an example. Create a cog for the starboard. You will probably end up using the on_reaction_add()
event listener to keep track of whether or not a message has been reacted to. The hardest part of this assignment will be keeping track of how many times a particular message has been starred so that you can update the stars shown in the starboard message in real time. For this I would use the database. Create a new SQL table that stores the message id of the starred message in particular, the number of stars for the message, and the message id for the message the bot reposts in the starboard channel. If you have trouble with this feel free to ask any questions :)
Getting hard to keep track of what the bot does. Should probably implement a help command for all users and a mod help command for just mods.
Should be fixable by using on_raw_reaction_add
;clear 12 @member
If you accidentally press a button to post to social media it seems there's no way to cancel. Also the bot pulls messages from other channels from you so we should probably confine the search to the social media post channel
While users have the ability to get a color and scheme from a photo, implement more color commands for general use. Make it so that users can get shown a color from a hex or RGB value. Also generate color palettes (kind of like how !scheme
works) from a hex color or randomly.
Maybe find a good way to implement color lookup so someone can type the name of a color and get a hex. Will be annoying since while most of us can agree what "red" looks like our common names for colors like "sky blue" are not standard and can vary from person to person.
Might be able to do !color red
for "give me a red" and it will return any variant of red.
As you mentioned, a little something to help out for D&D. Make a "!roll" command that looks at the arguments to determine whether a user wanted to role a d6, d8, or d20. Use RNG to give the user the dice they rolled.
Maybe as an added bonus mess around with embeds to embed custom images for each type of role for the d6 :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.