shadowcordv2 1.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. discord/__init__.py +78 -0
  2. discord/__main__.py +300 -0
  3. discord/abc.py +1689 -0
  4. discord/activity.py +842 -0
  5. discord/appinfo.py +247 -0
  6. discord/asset.py +415 -0
  7. discord/audit_logs.py +524 -0
  8. discord/backoff.py +105 -0
  9. discord/bin/libopus-0.x64.dll +0 -0
  10. discord/bin/libopus-0.x86.dll +0 -0
  11. discord/channel.py +2081 -0
  12. discord/client.py +1675 -0
  13. discord/colour.py +329 -0
  14. discord/components.py +383 -0
  15. discord/context_managers.py +87 -0
  16. discord/embeds.py +727 -0
  17. discord/emoji.py +255 -0
  18. discord/enums.py +612 -0
  19. discord/errors.py +277 -0
  20. discord/ext/__init__.py +15 -0
  21. discord/ext/commands/__init__.py +19 -0
  22. discord/ext/commands/_types.py +48 -0
  23. discord/ext/commands/bot.py +1118 -0
  24. discord/ext/commands/cog.py +472 -0
  25. discord/ext/commands/context.py +400 -0
  26. discord/ext/commands/converter.py +1182 -0
  27. discord/ext/commands/cooldowns.py +390 -0
  28. discord/ext/commands/core.py +2307 -0
  29. discord/ext/commands/errors.py +997 -0
  30. discord/ext/commands/flags.py +618 -0
  31. discord/ext/commands/help.py +1339 -0
  32. discord/ext/commands/view.py +192 -0
  33. discord/ext/tasks/__init__.py +756 -0
  34. discord/file.py +127 -0
  35. discord/flags.py +1068 -0
  36. discord/gateway.py +922 -0
  37. discord/guild.py +2944 -0
  38. discord/http.py +1969 -0
  39. discord/integrations.py +366 -0
  40. discord/interactions.py +767 -0
  41. discord/invite.py +478 -0
  42. discord/iterators.py +753 -0
  43. discord/member.py +908 -0
  44. discord/mentions.py +151 -0
  45. discord/message.py +1829 -0
  46. discord/mixins.py +47 -0
  47. discord/object.py +92 -0
  48. discord/oggparse.py +113 -0
  49. discord/opus.py +454 -0
  50. discord/partial_emoji.py +232 -0
  51. discord/permissions.py +750 -0
  52. discord/player.py +745 -0
  53. discord/py.typed +0 -0
  54. discord/raw_models.py +278 -0
  55. discord/reaction.py +211 -0
  56. discord/role.py +452 -0
  57. discord/shard.py +546 -0
  58. discord/stage_instance.py +176 -0
  59. discord/state.py +1530 -0
  60. discord/sticker.py +523 -0
  61. discord/team.py +145 -0
  62. discord/template.py +316 -0
  63. discord/threads.py +802 -0
  64. discord/types/__init__.py +10 -0
  65. discord/types/activity.py +114 -0
  66. discord/types/appinfo.py +67 -0
  67. discord/types/audit_log.py +257 -0
  68. discord/types/channel.py +157 -0
  69. discord/types/components.py +76 -0
  70. discord/types/embed.py +84 -0
  71. discord/types/emoji.py +46 -0
  72. discord/types/gateway.py +41 -0
  73. discord/types/guild.py +168 -0
  74. discord/types/integration.py +82 -0
  75. discord/types/interactions.py +236 -0
  76. discord/types/invite.py +99 -0
  77. discord/types/member.py +63 -0
  78. discord/types/message.py +138 -0
  79. discord/types/raw_models.py +87 -0
  80. discord/types/role.py +49 -0
  81. discord/types/snowflake.py +28 -0
  82. discord/types/sticker.py +93 -0
  83. discord/types/team.py +43 -0
  84. discord/types/template.py +49 -0
  85. discord/types/threads.py +74 -0
  86. discord/types/user.py +48 -0
  87. discord/types/voice.py +85 -0
  88. discord/types/webhook.py +70 -0
  89. discord/types/welcome_screen.py +40 -0
  90. discord/types/widget.py +63 -0
  91. discord/ui/__init__.py +15 -0
  92. discord/ui/button.py +290 -0
  93. discord/ui/item.py +131 -0
  94. discord/ui/select.py +357 -0
  95. discord/ui/view.py +529 -0
  96. discord/user.py +504 -0
  97. discord/utils.py +1019 -0
  98. discord/voice_client.py +676 -0
  99. discord/webhook/__init__.py +13 -0
  100. discord/webhook/async_.py +1589 -0
  101. discord/webhook/sync.py +1066 -0
  102. discord/widget.py +301 -0
  103. shadowcordv2-1.8.0.dist-info/METADATA +95 -0
  104. shadowcordv2-1.8.0.dist-info/RECORD +107 -0
  105. shadowcordv2-1.8.0.dist-info/WHEEL +5 -0
  106. shadowcordv2-1.8.0.dist-info/licenses/LICENSE +21 -0
  107. shadowcordv2-1.8.0.dist-info/top_level.txt +1 -0
discord/__init__.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ Discord API Wrapper
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ A basic wrapper for the Discord API.
6
+
7
+ :copyright: (c) 2015-present Rapptz
8
+ :license: MIT, see LICENSE for more details.
9
+
10
+ """
11
+
12
+ __title__ = 'discord'
13
+ __author__ = 'Rapptz'
14
+ __license__ = 'MIT'
15
+ __copyright__ = 'Copyright 2015-present Rapptz'
16
+ __version__ = "1.8.0"
17
+
18
+
19
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
20
+
21
+ import logging
22
+ from typing import NamedTuple, Literal
23
+
24
+ from .client import Client
25
+ from .appinfo import *
26
+ from .user import *
27
+ from .emoji import *
28
+ from .partial_emoji import *
29
+ from .activity import *
30
+ from .channel import *
31
+ from .guild import *
32
+ from .flags import *
33
+ from .member import *
34
+ from .message import *
35
+ from .asset import *
36
+ from .errors import *
37
+ from .permissions import *
38
+ from .role import *
39
+ from .file import *
40
+ from .colour import *
41
+ from .integrations import *
42
+ from .invite import *
43
+ from .template import *
44
+ from .widget import *
45
+ from .object import *
46
+ from .reaction import *
47
+ from . import utils, opus, abc, ui
48
+ from .enums import *
49
+ from .embeds import *
50
+ from .mentions import *
51
+ from .shard import *
52
+ from .player import *
53
+ from .webhook import *
54
+ from .voice_client import *
55
+ from .audit_logs import *
56
+ from .raw_models import *
57
+ from .team import *
58
+ from .sticker import *
59
+ from .stage_instance import *
60
+ from .interactions import *
61
+ from .components import *
62
+ from .threads import *
63
+
64
+
65
+ class VersionInfo(NamedTuple):
66
+ major: int
67
+ minor: int
68
+ micro: int
69
+ releaselevel: Literal["alpha", "beta", "candidate", "final"]
70
+ serial: int
71
+
72
+
73
+ version_info: VersionInfo = VersionInfo(major=1, minor=8, micro=0, releaselevel='final', serial=0)
74
+
75
+ logging.getLogger(__name__).addHandler(logging.NullHandler())
76
+
77
+ # Explicitly export Client
78
+ __all__ = ['Client']
discord/__main__.py ADDED
@@ -0,0 +1,300 @@
1
+ """
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2015-present Rapptz
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a
7
+ copy of this software and associated documentation files (the "Software"),
8
+ to deal in the Software without restriction, including without limitation
9
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ and/or sell copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ DEALINGS IN THE SOFTWARE.
23
+ """
24
+
25
+ import argparse
26
+ import sys
27
+ from pathlib import Path
28
+
29
+ import discord
30
+ import pkg_resources
31
+ import aiohttp
32
+ import platform
33
+
34
+ def show_version():
35
+ entries = []
36
+
37
+ entries.append('- Python v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}'.format(sys.version_info))
38
+ version_info = discord.version_info
39
+ entries.append('- discord.py v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}'.format(version_info))
40
+ if version_info.releaselevel != 'final':
41
+ pkg = pkg_resources.get_distribution('discord.py')
42
+ if pkg:
43
+ entries.append(f' - discord.py pkg_resources: v{pkg.version}')
44
+
45
+ entries.append(f'- aiohttp v{aiohttp.__version__}')
46
+ uname = platform.uname()
47
+ entries.append('- system info: {0.system} {0.release} {0.version}'.format(uname))
48
+ print('\n'.join(entries))
49
+
50
+ def core(parser, args):
51
+ if args.version:
52
+ show_version()
53
+
54
+ _bot_template = """#!/usr/bin/env python3
55
+
56
+ from discord.ext import commands
57
+ import discord
58
+ import config
59
+
60
+ class Bot(commands.{base}):
61
+ def __init__(self, **kwargs):
62
+ super().__init__(command_prefix=commands.when_mentioned_or('{prefix}'), **kwargs)
63
+ for cog in config.cogs:
64
+ try:
65
+ self.load_extension(cog)
66
+ except Exception as exc:
67
+ print(f'Could not load extension {{cog}} due to {{exc.__class__.__name__}}: {{exc}}')
68
+
69
+ async def on_ready(self):
70
+ print(f'Logged on as {{self.user}} (ID: {{self.user.id}})')
71
+
72
+
73
+ bot = Bot()
74
+
75
+ # write general commands here
76
+
77
+ bot.run(config.token)
78
+ """
79
+
80
+ _gitignore_template = """# Byte-compiled / optimized / DLL files
81
+ __pycache__/
82
+ *.py[cod]
83
+ *$py.class
84
+
85
+ # C extensions
86
+ *.so
87
+
88
+ # Distribution / packaging
89
+ .Python
90
+ env/
91
+ build/
92
+ develop-eggs/
93
+ dist/
94
+ downloads/
95
+ eggs/
96
+ .eggs/
97
+ lib/
98
+ lib64/
99
+ parts/
100
+ sdist/
101
+ var/
102
+ *.egg-info/
103
+ .installed.cfg
104
+ *.egg
105
+
106
+ # Our configuration files
107
+ config.py
108
+ """
109
+
110
+ _cog_template = '''from discord.ext import commands
111
+ import discord
112
+
113
+ class {name}(commands.Cog{attrs}):
114
+ """The description for {name} goes here."""
115
+
116
+ def __init__(self, bot):
117
+ self.bot = bot
118
+ {extra}
119
+ def setup(bot):
120
+ bot.add_cog({name}(bot))
121
+ '''
122
+
123
+ _cog_extras = '''
124
+ def cog_unload(self):
125
+ # clean up logic goes here
126
+ pass
127
+
128
+ async def cog_check(self, ctx):
129
+ # checks that apply to every command in here
130
+ return True
131
+
132
+ async def bot_check(self, ctx):
133
+ # checks that apply to every command to the bot
134
+ return True
135
+
136
+ async def bot_check_once(self, ctx):
137
+ # check that apply to every command but is guaranteed to be called only once
138
+ return True
139
+
140
+ async def cog_command_error(self, ctx, error):
141
+ # error handling to every command in here
142
+ pass
143
+
144
+ async def cog_before_invoke(self, ctx):
145
+ # called before a command is called here
146
+ pass
147
+
148
+ async def cog_after_invoke(self, ctx):
149
+ # called after a command is called here
150
+ pass
151
+
152
+ '''
153
+
154
+
155
+ # certain file names and directory names are forbidden
156
+ # see: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
157
+ # although some of this doesn't apply to Linux, we might as well be consistent
158
+ _base_table = {
159
+ '<': '-',
160
+ '>': '-',
161
+ ':': '-',
162
+ '"': '-',
163
+ # '/': '-', these are fine
164
+ # '\\': '-',
165
+ '|': '-',
166
+ '?': '-',
167
+ '*': '-',
168
+ }
169
+
170
+ # NUL (0) and 1-31 are disallowed
171
+ _base_table.update((chr(i), None) for i in range(32))
172
+
173
+ _translation_table = str.maketrans(_base_table)
174
+
175
+ def to_path(parser, name, *, replace_spaces=False):
176
+ if isinstance(name, Path):
177
+ return name
178
+
179
+ if sys.platform == 'win32':
180
+ forbidden = ('CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', \
181
+ 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9')
182
+ if len(name) <= 4 and name.upper() in forbidden:
183
+ parser.error('invalid directory name given, use a different one')
184
+
185
+ name = name.translate(_translation_table)
186
+ if replace_spaces:
187
+ name = name.replace(' ', '-')
188
+ return Path(name)
189
+
190
+ def newbot(parser, args):
191
+ new_directory = to_path(parser, args.directory) / to_path(parser, args.name)
192
+
193
+ # as a note exist_ok for Path is a 3.5+ only feature
194
+ # since we already checked above that we're >3.5
195
+ try:
196
+ new_directory.mkdir(exist_ok=True, parents=True)
197
+ except OSError as exc:
198
+ parser.error(f'could not create our bot directory ({exc})')
199
+
200
+ cogs = new_directory / 'cogs'
201
+
202
+ try:
203
+ cogs.mkdir(exist_ok=True)
204
+ init = cogs / '__init__.py'
205
+ init.touch()
206
+ except OSError as exc:
207
+ print(f'warning: could not create cogs directory ({exc})')
208
+
209
+ try:
210
+ with open(str(new_directory / 'config.py'), 'w', encoding='utf-8') as fp:
211
+ fp.write('token = "place your token here"\ncogs = []\n')
212
+ except OSError as exc:
213
+ parser.error(f'could not create config file ({exc})')
214
+
215
+ try:
216
+ with open(str(new_directory / 'bot.py'), 'w', encoding='utf-8') as fp:
217
+ base = 'Bot' if not args.sharded else 'AutoShardedBot'
218
+ fp.write(_bot_template.format(base=base, prefix=args.prefix))
219
+ except OSError as exc:
220
+ parser.error(f'could not create bot file ({exc})')
221
+
222
+ if not args.no_git:
223
+ try:
224
+ with open(str(new_directory / '.gitignore'), 'w', encoding='utf-8') as fp:
225
+ fp.write(_gitignore_template)
226
+ except OSError as exc:
227
+ print(f'warning: could not create .gitignore file ({exc})')
228
+
229
+ print('successfully made bot at', new_directory)
230
+
231
+ def newcog(parser, args):
232
+ cog_dir = to_path(parser, args.directory)
233
+ try:
234
+ cog_dir.mkdir(exist_ok=True)
235
+ except OSError as exc:
236
+ print(f'warning: could not create cogs directory ({exc})')
237
+
238
+ directory = cog_dir / to_path(parser, args.name)
239
+ directory = directory.with_suffix('.py')
240
+ try:
241
+ with open(str(directory), 'w', encoding='utf-8') as fp:
242
+ attrs = ''
243
+ extra = _cog_extras if args.full else ''
244
+ if args.class_name:
245
+ name = args.class_name
246
+ else:
247
+ name = str(directory.stem)
248
+ if '-' in name or '_' in name:
249
+ translation = str.maketrans('-_', ' ')
250
+ name = name.translate(translation).title().replace(' ', '')
251
+ else:
252
+ name = name.title()
253
+
254
+ if args.display_name:
255
+ attrs += f', name="{args.display_name}"'
256
+ if args.hide_commands:
257
+ attrs += ', command_attrs=dict(hidden=True)'
258
+ fp.write(_cog_template.format(name=name, extra=extra, attrs=attrs))
259
+ except OSError as exc:
260
+ parser.error(f'could not create cog file ({exc})')
261
+ else:
262
+ print('successfully made cog at', directory)
263
+
264
+ def add_newbot_args(subparser):
265
+ parser = subparser.add_parser('newbot', help='creates a command bot project quickly')
266
+ parser.set_defaults(func=newbot)
267
+
268
+ parser.add_argument('name', help='the bot project name')
269
+ parser.add_argument('directory', help='the directory to place it in (default: .)', nargs='?', default=Path.cwd())
270
+ parser.add_argument('--prefix', help='the bot prefix (default: $)', default='$', metavar='<prefix>')
271
+ parser.add_argument('--sharded', help='whether to use AutoShardedBot', action='store_true')
272
+ parser.add_argument('--no-git', help='do not create a .gitignore file', action='store_true', dest='no_git')
273
+
274
+ def add_newcog_args(subparser):
275
+ parser = subparser.add_parser('newcog', help='creates a new cog template quickly')
276
+ parser.set_defaults(func=newcog)
277
+
278
+ parser.add_argument('name', help='the cog name')
279
+ parser.add_argument('directory', help='the directory to place it in (default: cogs)', nargs='?', default=Path('cogs'))
280
+ parser.add_argument('--class-name', help='the class name of the cog (default: <name>)', dest='class_name')
281
+ parser.add_argument('--display-name', help='the cog name (default: <name>)')
282
+ parser.add_argument('--hide-commands', help='whether to hide all commands in the cog', action='store_true')
283
+ parser.add_argument('--full', help='add all special methods as well', action='store_true')
284
+
285
+ def parse_args():
286
+ parser = argparse.ArgumentParser(prog='discord', description='Tools for helping with discord.py')
287
+ parser.add_argument('-v', '--version', action='store_true', help='shows the library version')
288
+ parser.set_defaults(func=core)
289
+
290
+ subparser = parser.add_subparsers(dest='subcommand', title='subcommands')
291
+ add_newbot_args(subparser)
292
+ add_newcog_args(subparser)
293
+ return parser, parser.parse_args()
294
+
295
+ def main():
296
+ parser, args = parse_args()
297
+ args.func(parser, args)
298
+
299
+ if __name__ == '__main__':
300
+ main()