1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

素数判定をしてくれるDiscordBotをつくる。

Posted at

import discord
from sympy import sieve

TOKEN = '' # TOKENを貼り付け
CHANNELID = 00000000000000 # チャンネルIDを貼り付け

client = discord.Client()

@client.event
async def on_ready():
    print('ログインしました')

@client.event
async def on_message(message):
    if not message.author.bot:
        channel = client.get_channel(CHANNELID)
        print(message.content)
        if str(message.content).isdigit():
            await channel.send(int(message.content) in sieve)

client.run(TOKEN)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?