Skip to content

Instantly share code, notes, and snippets.

@sekika
Created August 15, 2022 18:21
Show Gist options
  • Save sekika/aff133b238bdfb8ebc1e67ec89bf7f44 to your computer and use it in GitHub Desktop.
Save sekika/aff133b238bdfb8ebc1e67ec89bf7f44 to your computer and use it in GitHub Desktop.
import discord
class Client(discord.Client):
async def on_ready(self):
if hasattr(self, 'action'):
for action in self.action:
if action[0] == 1:
user = await self.fetch_user(action[1])
await user.send(action[2])
if action[0] == 2:
channel = self.get_channel(action[1])
await channel.send(action[2])
await self.close()
def send_dm(self, user_id, message):
if not hasattr(self, 'action'):
self.action = []
self.action.append((1, user_id, message))
def send_channel(self, channel_id, message):
if not hasattr(self, 'action'):
self.action = []
self.action.append((2, channel_id, message))
@sekika
Copy link
Author

sekika commented Aug 16, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment