Last active
April 12, 2022 11:32
-
-
Save yhay81/31d1402e29d4f635d1c878909b30f82a to your computer and use it in GitHub Desktop.
Discord bot who can pin messages with just adding reaction π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
client = discord.Client() | |
@client.event | |
async def on_ready(): | |
print('Logged in as') | |
print(client.user.name) | |
print(client.user.id) | |
print('------') | |
@client.event | |
async def on_server_join(server): | |
return await client.send_message( | |
server.default_channel, | |
""" Just add reaction of π, and the message pinned! """ | |
) | |
@client.event | |
async def on_reaction_add(reaction, user): | |
if str(reaction.emoji) == "π": | |
await client.pin_message(reaction.message) | |
@client.event | |
async def on_reaction_remove(reaction, user): | |
if reaction.emoji == "π": | |
if not ":pushpin:" in [ reaction.emoji for reaction in reaction.message.reactions]: | |
await client.unpin_message(reaction.message) | |
if __name__ == '__main__': | |
client.run('YOUR CLIENT SECRET') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment